Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could not complete operation due to error 80041003 2

Status
Not open for further replies.

tripp2222

Technical User
Nov 30, 2004
32
US
I am receiving the error message "Could not complete operation due to error 80041003" when trying to run my script to another domain. The 80041003 message is the same as access denied, but I do have access. The code stops on line 70. I have the number 70 next to it. Any help would be greatly appreciated.
If strComputerName = "" Then
Set wmiRoot = GetObject("WinMgmts:root/cimv2")
Set wmiColl = wmiRoot.ExecQuery("Select * FROM Win32_ComputerSystem")
For Each wmiObj In wmiColl
strComputerName = wmiObj.Name
Next
Else
70 Set wmiRoot = GetObject("WinMgmts://"&strComputerName&"/root/cimv2")
End If
 
Do a search for "WbemScripting.SWbemLocator" and "ConnectServer" which will let you connect to WMI using alternate credentials.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
eg.

On Error Resume Next
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer _
(strComputer, "root\microsoftADS", strUserAccount, strPassword)
objSWbemServices.Security_.ImpersonationLevel = 3
If Err.Number <> 0 Then
Msgbox "ADS WMI connection error, check username and password or servername/ip"
Wscript.Quit 4
End If
On Error Goto 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top