Discussion:
ConnectServer failed with Code: 80070005
(too old to reply)
fiNAL.Y
2007-09-12 21:08:01 UTC
Permalink
Hi,

I have the following script:

strComputer = "someip"
strUser = "user"
strPassword = "password"

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root
\cimv2", strUser, strPassword)
Set colSwbemObjectSet = objSWbemServices.ExecQuery("Select * From
Win32_Process")
For Each objProcess in colSWbemObjectSet
Wscript.Echo "Process Name: " & objProcess.Name
Next

and it failed with Access Denied (Code: 80070005) every time.

The target machine is running Windows Server 2003 and my machine is
running XP Pro SP2

I'm running the script as administrator and the remote user on the
target machine is a member of the Administrators group. Neither of the
two machines is in a domain and they're in different workgroups.

Can any one help me with this ? Thanks very much.
Jonathan Liu [MSFT]
2007-10-01 22:13:58 UTC
Permalink
Please read this article and see if it solves your problems:

"Connecting to WMI on a Remote Computer"
http://msdn2.microsoft.com/en-us/library/Aa389290.aspx
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--
Post by fiNAL.Y
Hi,
strComputer = "someip"
strUser = "user"
strPassword = "password"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root
\cimv2", strUser, strPassword)
Set colSwbemObjectSet = objSWbemServices.ExecQuery("Select * From
Win32_Process")
For Each objProcess in colSWbemObjectSet
Wscript.Echo "Process Name: " & objProcess.Name
Next
and it failed with Access Denied (Code: 80070005) every time.
The target machine is running Windows Server 2003 and my machine is
running XP Pro SP2
I'm running the script as administrator and the remote user on the
target machine is a member of the Administrators group. Neither of the
two machines is in a domain and they're in different workgroups.
Can any one help me with this ? Thanks very much.
Loading...