I have slowly been learning powershell over the past few months to help automate a lot of my tasks. Though it seems to have the same limitations with WMI as VBScript. Many times the script will just hang and not return anything forcing you to kill your script and start over. I read some snippets here and there about [WMISearcher] and being able to add a timeout to your WMI calls, so if it doesn't return in X seconds, it halts the call.
I am having trouble finding anything past a very high level overview of it. Examples are extremely rare to come by and really haven't provided any insight onto how I can implement it for my use.
So that said, can anyone provide some examples of how it would be used for a WMI call on a remote machine?
If it does hit the time out and terminate the WMI connection, what is returned? Is it an error that can be caught?
An example of what I would like to do with it:
I have a script that will run through a list of servers in my environment, I want to check a few services through WMI to see if they are installed, and if they are see if they are started. I know how to do this, but the problem I face is that the script just hangs on a lot of my really old W2k boxes and never returns.
Can anyone help?
|