Open-AudIT https://www.open-audit.org/phpBB3/ |
|
ConnectServer() fails on older systems (audit.vbs) https://www.open-audit.org/phpBB3/viewtopic.php?f=8&t=4451 |
Page 1 of 1 |
Author: | smorloc [ Mon Feb 28, 2011 10:43 am ] |
Post subject: | ConnectServer() fails on older systems (audit.vbs) |
On some Windows systems, the ConnectServer() reports an invalid parameter error if wbemConnectFlagUseMaxWait is used. A workaround is to retry the ConnectServer() operation without the parameter when an error occurs. In Audit.vbs, I would suggest changing code like this: [code] Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUser, strPass, "", "", wbemConnectFlagUseMaxWait) [/code] To this: [code] Const wbemErrInvalidParameter = &H80041008 [...] On Error Resume Next Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUser, strPass, "", "", wbemConnectFlagUseMaxWait) If Err.Number = wbemErrInvalidParameter Then ' The flag wbemConnectFlagUseMaxWait apparently is not supported on all systems... Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUser, strPass, "", "", 0) End If [/code] Steve |
Page 1 of 1 | All times are UTC + 10 hours |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |