TRY/CATCH Handling for Server Logon Permission Errors

Oct 1, 2013 at 11:40 PM
How can I modify the Get-WindowsInventoryToClixml.ps1 file to handle server logon errors with TRY/CATCH , and skip to the next Server to Logon to on in the list?
Oct 3, 2013 at 7:36 PM
Hi Barnyardi,
That's already in the code - when 3 errors are encountered the code gives up on the server and moves on. I should also note that if you specify multiple servers to include in the inventory the code is pseudo-multithreaded. I say pseudo because PowerShell doesn't support true multithreading, but basically by default the code will attempt to simultaneously inventory as many servers as there are logical CPUs on the machine where the code is running.

For now, if you want to modify the error threshold change the value of ScanErrorThreshold in WindowsInventory.psm1 (line 6).

I can hook this up as a parameter for the inventory scripts in the next version.

Thanks for checking out SQL Power Doc!