Using -ExcludeProperty in SQLPSX

Aug 7, 2015 at 7:55 AM
I was unable to use this command on my resultset.

| Select-Object -ExcludeProperty RowError, RowState, Table, ItemArray, HasErrors

The thing is, I want to generate an HTML export of a query, but in there are the hated rows mentioned above.

I´m using this module to convert to html:

My command is the following:
@{Object = $bla} | Export-HtmlReport -OutputFile "C:\Export-HtmlReport\test.html"

Is it possible to use the -ExcludeProperty parameter with SQLPSX?
Aug 7, 2015 at 5:44 PM
Edited Aug 7, 2015 at 5:44 PM
I was able to run this with no problems. I'm not using the Export-HRMLReport function, but export-csv worked fine and the columns you were looking to exclude were excluded.
 invoke-query 'select * from sys.databases' -server SERVERNAME| select -ExcludeProperty RowError, RowState, Table, ItemArray, HasErrors | export-csv c:\temp\test.csv
Aug 10, 2015 at 5:02 PM
Hello MikeShepard,
thank you for your answer.
I just tested it and it´s not working with Export-HTML. But I finally solved it this way:
$Output = "C:\test.html"
$Check = New-Object System.Collections.Generic.List[Object]

Get-SqlData -sqlserver $SQLServer -dbname $SQLDBName -qry "SELECT * FROM $TableName;" | ForEach-Object{
    $Obj =  New-Object PSObject -Property @{
        Title = $_.Title
        Name = $_.Name
    } | Select Title, Name

$InputObject =  @{Object = $Check}          
Export-HtmlReport -InputObject $InputObject -OutputFile $Output
No unused SQL stuff, just a nice HTML Report of the important collums.
Maybe it´s usefull for others to.