From Svendsen Tech PowerShell Wiki
Jump to: navigation, search
Changing the WMI Timeout Value for a Series of WMI Queries
== Changing the WMI Timeout Value for a Series of WMI Queries ==
NB! Old article, quality is not superb. Comment made 2020-03-17.
To change/tweak the WMI timeout value, you can instantiate a WMI or WMI searcher object and set its timeout property, which is a time span object. In this informational top example, it's done through the PSBase member set. Notice the empty string after the [wmi] type accelerator in the example directly below. The WMI timeout is only changed for that specific object instance, so this is basically useless other than for the sake of enlightenment.
The example further down uses a [WmiSearcher] object and sets its properties. This top example is for informational purposes only. Look at the [[Powershell_change_the_wmi_timeout_value#Source_Code|source code]] below to see the real deal immediately.
'''Now the bad news''': During testing I discovered that the clients that "get stuck" still get stuck... And the timeout appears only to be in effect if WMI is working properly on the target computer. It appears to be limiting the time an actual query takes, not when to abort the attempt. Now that makes it a lot less useful; I will have to dig deeper to see if this broken behavior is at all remediable.
Also consider checking out the [[Get-wmiobject_wrapper|PowerShell Get-WmiObject Wrapper script here]]. It's pretty darn useful.

Navigation menu