Microsoft Software & Solutions: Remote connection issue using GetObject("winmgmts:\\" ...

  • jaisol / 204 / Tues, 09 Mar 2010 12:36:00 GMT / Comments (8)
  • 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

  • Keywords:

    remote, connection, issue, getobject, winmgmts, microsoft, software, solutions

  • http://www.edevs.com/microsoft-software/66741/«« Last Thread - Next Thread »»
    1. Jaisol wrote:
      > Hi,
      > For unknown reason I can't connect any server remotely via
      > GetObject("winmgmts:\\" & strComputer & ...) but I can connect them


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


      > 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

      Michael Harris
      MVP - Admin Frameworks

      michaelharris_mvp | Sun, 01 Jun 2008 15:54:32 GMT |

    2. Michael Harris (MVP) wrote:
      > Jaisol wrote:
      >
      > Try it with... "winmgmts://"


      Never mind...\\ vs. // doesn't seem to matter.
      [vbcol=seagreen]
      >
      Michael Harris
      MVP - Admin Frameworks

      michaelharris_mvp | Sun, 01 Jun 2008 15:55:32 GMT |

    3. Jaisol wrote:

      > 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,authenticationLev el=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.
      Richard Mueller
      Microsoft MVP Scripting and ADSI
      Hilltop Lab - http://www.rlmueller.net

      richardmuellermvp | Sun, 01 Jun 2008 15:56:41 GMT |

    4. 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
      "Richard Mueller [MVP]" <rlmueller-nospam...ameritech.nospam.net> wrote in
      message news:ekNv1d72HHA.2064...TK2MSFTNGP03.phx.gbl...
      > Jaisol wrote:
      >
      > For best results with all OS combinations I use:
      > Set m_WMIService = GetObject("winmgmts:" _
      > & "{impersonationLevel=impersonate,authenticationLev el=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.
      > --
      > Richard Mueller
      > Microsoft MVP Scripting and ADSI
      > Hilltop Lab - http://www.rlmueller.net
      > --
      >


      jaisol | Sun, 01 Jun 2008 15:57:36 GMT |

    5. 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
      "Michael Harris (MVP)" <mikhar.at.mvps.dot.org> wrote in message
      news:%23eBjDk62HHA.212...TK2MSFTNGP05.phx.gbl...
      > Michael Harris (MVP) wrote:
      > Never mind...\\ vs. // doesn't seem to matter.
      >
      > --
      > Michael Harris
      > MVP - Admin Frameworks
      >


      jaisol | Sun, 01 Jun 2008 15:58:35 GMT |

    6. "Richard Mueller [MVP]" <rlmueller-nospam...ameritech.nospam.net> wrote in
      message news:ekNv1d72HHA.2064...TK2MSFTNGP03.phx.gbl...
      > 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.
      > --
      > Richard Mueller
      > Microsoft MVP Scripting and ADSI
      > Hilltop Lab - http://www.rlmueller.net
      > --
      >


      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

      tdm | Sun, 01 Jun 2008 15:59:45 GMT |

    7. "TDM" <rpuffd...gmail.com> wrote in message
      news:ed6ZpM43HHA.4676...TK2MSFTNGP05.phx.gbl...
      > "Richard Mueller [MVP]" <rlmueller-nospam...ameritech.nospam.net> wrote in
      > message news:ekNv1d72HHA.2064...TK2MSFTNGP03.phx.gbl...
      >
      > 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 cant 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.

      Richard Mueller
      Microsoft MVP Scripting and ADSI
      Hilltop Lab - http://www.rlmueller.net

      richardmuellermvp | Sun, 01 Jun 2008 16:00:37 GMT |

    8. "Richard Mueller [MVP]" <rlmueller-nospam...ameritech.nospam.net> wrote in
      message news:eCmenb43HHA.5880...TK2MSFTNGP03.phx.gbl...
      > "TDM" <rpuffd...gmail.com> wrote in message
      > news:ed6ZpM43HHA.4676...TK2MSFTNGP05.phx.gbl...
      > 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 cant 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.
      >
      > --
      > Richard Mueller
      > Microsoft MVP Scripting and ADSI
      > Hilltop Lab - http://www.rlmueller.net
      > --
      >


      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
      Richard Mueller
      Microsoft MVP Scripting and ADSI
      Hilltop Lab - http://www.rlmueller.net

      richardmuellermvp | Sun, 01 Jun 2008 16:01:40 GMT |