Author Posts

April 13, 2018 at 12:41 am

I have started a new job and been asked to clean up approximately 300 crystal reports. Ideally I would be able to source the name and fields used in each report without opening then individually.

I found some code and it seems that it's executing, but not recording the output anywhere. I'm very new to PowerShell so struggling a bit!

Get-ChildItem 'S:\Reports\SITE' *.rpt -Recurse  | % {

    $_.Database.Tables | Select-Object location -Expand location
    $_.Subreports | % { $_.Database.Tables | Select-Object location -Expand location }

} | Select-Object location -Unique | Sort-Object Location

April 13, 2018 at 4:15 am

You don't show what is in this...

Get-ChildItem 'S:\Reports\SITE' *.rpt

So, you need to step through you code one segment at a time to make sure you are getting something to work with.

Secondly. doing this sort of thing...

    
$_.Database.Tables | Select-Object location -Expand location
$_.Subreports | % { $_.Database.Tables | Select-Object location -Expand location

... is really not a thing. In order to use dot notation, the thing you are looking at must be a object that has such properties.