Hello,
I got the WMI code to run the script using an alternate credential, and it used to work. After Windows Server 2003 SP2 has been applied to my environment, the script generates the access denied error.
The code is listed below:
Const WbemAuthenticationLevelPktPrivacy = 6
strComputer = "server1"
strNamespace = "root\cimv2"
strUser = "administrator"
strPassword = "password"
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)
objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_OperatingSystem")
For Each objItem in ColItems
Wscript.Echo strComputer & ": " & objItem.Caption
Next
I got the access error at the line:
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)
I tested all my domain credential, and it worked fine including logging onto the server with the same credential.
What could be done to resolve this issue? Any help will be greatly appreciated.
I got the WMI code to run the script using an alternate credential, and it used to work. After Windows Server 2003 SP2 has been applied to my environment, the script generates the access denied error.
The code is listed below:
Const WbemAuthenticationLevelPktPrivacy = 6
strComputer = "server1"
strNamespace = "root\cimv2"
strUser = "administrator"
strPassword = "password"
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)
objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_OperatingSystem")
For Each objItem in ColItems
Wscript.Echo strComputer & ": " & objItem.Caption
Next
I got the access error at the line:
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)
I tested all my domain credential, and it worked fine including logging onto the server with the same credential.
What could be done to resolve this issue? Any help will be greatly appreciated.