Remote connection issue using GetObject("winmgmts:\\" ...

J

Jaisol

Hi,

For unknown reason I can't connect any server remotely via
GetObject("winmgmts:\\" & strComputer & ...) but I can connect them using
GetObject("IIS://" & strComputer & "/w3svc") with success.

I got Microsoft VBScript runtime error: The remote server machine does not
exist or is unavailable: 'GetObject' when I use the first method but not
when I use the second one....so, what is the difference?

I tried to connect using CreateObject("WbemScripting.SWbemLocator") but it
didn't work. In this case I got SWbemLocator: The RPC server is unavailable.

Can I use another method to connect remotely like GetObject("IIS://" &
strComputer & "/w3svc")?

How can I resolve that?


Thanks a lot,
Jaisol
 
M

Michael Harris \(MVP\)

Jaisol said:
Hi,

For unknown reason I can't connect any server remotely via
GetObject("winmgmts:\\" & strComputer & ...) but I can connect them


Try it with... "winmgmts://"
 
R

Richard Mueller [MVP]

Jaisol said:
For unknown reason I can't connect any server remotely via
GetObject("winmgmts:\\" & strComputer & ...) but I can connect them using
GetObject("IIS://" & strComputer & "/w3svc") with success.

I got Microsoft VBScript runtime error: The remote server machine does not
exist or is unavailable: 'GetObject' when I use the first method but not
when I use the second one....so, what is the difference?

I tried to connect using CreateObject("WbemScripting.SWbemLocator") but it
didn't work. In this case I got SWbemLocator: The RPC server is
unavailable.

Can I use another method to connect remotely like GetObject("IIS://" &
strComputer & "/w3svc")?

For best results with all OS combinations I use:

Set m_WMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")


If this doesn't work, either the remote computer doesn't have WMI installed,
you lack permissions, WMI is blocked, or WMI is corrupted. Sometimes you can
fix things by stopping and starting the WMI service on the remote computer.
 
J

Jaisol

Well...I forgot something....all remote machines are servers with windows
2003 enterprise edition sp1 and they are distributed in 3 environments:
development, pre-production and production.
I'm getting error just from production servers however I'm sure those
machines have WMI installed and it is working perfectly on each because I
can do everything locally (using strComputer = ".") with WMI.
I've tested your advice and it didn't work :-(

I'm part of administrators group on production servers as I'm in others
(development and pre-prod) then I suppose I have permissions required. Is
that correct or not?

Something else, I can connect with success to production servers using
GetObject("IIS://" & strComputer & "/w3svc"), I always thought it's WMI. Is
it WMI or not?

Maybe some special configuration is taked on production servers. Can WMI
allow special configuration? How can I verify it if it is? Or should I look
on other window configuration?

Thanks again,
Jaisol
 
J

Jaisol

Well...I forgot something....all remote machines are servers with windows
2003 enterprise edition sp1 and they are distributed in 3 environments:
development, pre-production and production.
I'm getting error just from production servers however I'm sure those
machines have WMI installed and it is working perfectly on each because I
can do everything locally (using strComputer = ".") with WMI.

I'm part of administrators group on production servers as I'm in others
(development and pre-prod) then I suppose I have permissions required. Is
that correct or not?

Something else, I can connect with success to production servers using
GetObject("IIS://" & strComputer & "/w3svc"), I always thought it's WMI. Is
it WMI or not?

Maybe some special configuration is taked on production servers. Can WMI
allow special configuration? How can I verify it if it is? Or should I look
on other window configuration?

Thanks again,
Jaisol

---
 
T

TDM

Richard Mueller said:
Jaisol wrote:
If this doesn't work, either the remote computer doesn't have WMI
installed, you lack permissions, WMI is blocked, or WMI is corrupted.
Sometimes you can fix things by stopping and starting the WMI service on
the remote computer.

Not to mention that WMI will not get through the Windows Firewall, BOTH
systems
must have the firewall turned off for WMI to connect to remote hosts.

TDM
 
R

Richard Mueller [MVP]

TDM said:
Not to mention that WMI will not get through the Windows Firewall, BOTH
systems
must have the firewall turned off for WMI to connect to remote hosts.

TDM

Also, an excellent article on troubleshooting WMI:

http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx

Regarding firewalls, I paste this from the link:
A firewall is blocking access to the remote computer. WMI uses the DCOM
(Distributed COM) and RPC (Remote Procedure Call) protocols to traverse the
network. By default, many firewalls block DCOM and RPC traffic; if your
firewall is blocking these protocols then your script will fail. For
example, the Windows Firewall found in Microsoft Windows XP Service Pack 2
is configured to automatically block all unsolicited network traffic,
including DCOM and WMI: in its default configuration, the Windows Firewall
will reject an incoming WMI request and give you a “Remote server machine
does not exist or is unavailable” error

If you are sure that a computer is online and you know that you have local
administrator rights on that computer, then problems getting past a firewall
often explain why your script is failing. We can’t tell you how to configure
your firewall to permit DCOM and RPC traffic; that obviously depends on the
type of firewall you have. However, if you suspect that the Windows Firewall
is to blame you can find information about managing and configuring the
firewall settings in the article I Married Bigfoot! Oh, and Windows Service
Pack 2 Made My Computer Disappear. The WMI SDK also has additional
information about connecting to the WMI service through the Windows
firewall.
 
R

Richard Mueller [MVP]

Richard Mueller said:
Also, an excellent article on troubleshooting WMI:

http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx

Regarding firewalls, I paste this from the link:
A firewall is blocking access to the remote computer. WMI uses the DCOM
(Distributed COM) and RPC (Remote Procedure Call) protocols to traverse
the network. By default, many firewalls block DCOM and RPC traffic; if
your firewall is blocking these protocols then your script will fail. For
example, the Windows Firewall found in Microsoft Windows XP Service Pack 2
is configured to automatically block all unsolicited network traffic,
including DCOM and WMI: in its default configuration, the Windows Firewall
will reject an incoming WMI request and give you a “Remote server machine
does not exist or is unavailable” error

If you are sure that a computer is online and you know that you have local
administrator rights on that computer, then problems getting past a
firewall often explain why your script is failing. We can’t tell you how
to configure your firewall to permit DCOM and RPC traffic; that obviously
depends on the type of firewall you have. However, if you suspect that the
Windows Firewall is to blame you can find information about managing and
configuring the firewall settings in the article I Married Bigfoot! Oh,
and Windows Service Pack 2 Made My Computer Disappear. The WMI SDK also
has additional information about connecting to the WMI service through the
Windows firewall.

That "Bigfoot" link above didn't paste like I thought. Here is the link:

http://www.microsoft.com/technet/scriptcenter/resources/tales/sg1104.mspx#EYC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top