When I wrote SCOM VBScripts in the past, it was easy to test the script and see if I was getting the right output.
I would simply run the cscript command from the command prompt to get the output.
C:\temp2\cscript count.vbs "c:\temp2" 4
But now with a similar SCOM PowerShell script I get useless output.
PS C:\temp2\ .\filecount.ps1 -Folder ‘C:\temp2’ -FCount 5
To fix this I have to add a simple line of code to the end of my PowerShell script
Now I can see the same output that my VBScripts gave me in the past.
Don’t forget to comment the line out after you are done testing.