Answer the question
In order to leave comments, you need to log in
WMI idle timeout
Hello. By the will of fate, he was forced to collide with WMI. There are no special problems, in principle everything is simple and clear, but there is the following point:
Let's say I want to write a script that periodically performs some requests to the server. The time between requests varies, say, from five minutes to an hour.
So, if more than fifteen minutes (approximately) pass between requests, the request fails, it throws an error: "The object invoked has disconnected from its clients".
I looked at RPC packets with a sniffer, and in case of such an error, there is a packet containing the RPC_E_DISCONNECTED error code.
Here is a test VBS script:
As far as I understand, somewhere on the side there is a session disconnection if no requests have been received from the client for a certain time.
strComputer = "10.77.0.202"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemService = objSWbemLocator.ConnectServer (strComputer, "root\cimv2", "Administrator", "1")
Set colItems = objSWbemService.ExecQuery("select Name from Win32_ComputerSystem",,48)
For Each objItem in colItems
Wscript.Echo "Name: "& objItem.Name
Next
WScript.Sleep 2200000
Wscript.Echo "test"
Set colItems = objSWbemService.ExecQuery("select Name from Win32_ComputerSystem",,48)
For Each objItem in colItems
Wscript.Echo "Name: "& objItem.Name
Next
Tell me, dear experts, how to get around this problem?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question