Windows Vista Forums

Connecting to Win32_DFSTarget on Windows Server 2008
  1. #1


    HAL07 Guest

    Connecting to Win32_DFSTarget on Windows Server 2008

    I am using the following script for listing DFS on a server:

    strComputer = "SERVERNAME1"
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colDfsNodes = objWMIService.ExecQuery _
    ("Select * from Win32_DFSNode")

    For each objDfsNode in colDfsNodes
    Wscript.Echo "Caption: " & objDfsNode.Caption
    Wscript.Echo "Description: " & objDfsNode.Description
    Wscript.Echo "Install Date: " & objDfsNode.InstallDate
    Wscript.Echo "Name: " & objDfsNode.Name
    Wscript.Echo "Root: " & objDfsNode.Root
    Wscript.Echo "State: " & objDfsNode.State
    Wscript.Echo "Status: " & objDfsNode.Status
    Wscript.Echo "Timeout: " & objDfsNode.Timeout
    Next



    (from http://www.activexperts.com/activmon...ts/storage/dfs )

    This script does not work when connecting to a Windows Server 2008, however it works fine on Windows 2003 Server.

    So. Any clues?


    --
    -- HAL07, Engineering Services, Norway

      My System SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: Connecting to Win32_DFSTarget on Windows Server 2008


    "HAL07" <yahoohal@xxxxxx> wrote in message
    news:eop0X95fJHA.1292@xxxxxx

    >I am using the following script for listing DFS on a server:
    >
    > strComputer = "SERVERNAME1"
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    >
    > Set colDfsNodes = objWMIService.ExecQuery _
    > ("Select * from Win32_DFSNode")
    >
    > For each objDfsNode in colDfsNodes
    > Wscript.Echo "Caption: " & objDfsNode.Caption
    > Wscript.Echo "Description: " & objDfsNode.Description
    > Wscript.Echo "Install Date: " & objDfsNode.InstallDate
    > Wscript.Echo "Name: " & objDfsNode.Name
    > Wscript.Echo "Root: " & objDfsNode.Root
    > Wscript.Echo "State: " & objDfsNode.State
    > Wscript.Echo "Status: " & objDfsNode.Status
    > Wscript.Echo "Timeout: " & objDfsNode.Timeout
    > Next
    >
    > (from
    > http://www.activexperts.com/activmon...ts/storage/dfs )
    >
    > This script does not work when connecting to a Windows Server 2008,
    > however it works fine on Windows 2003 Server.
    >
    > So. Any clues?
    Does it help to use authenticationLevel:

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

    If the script works on the server, but not remotely, then perhaps DCOM is
    disabled. You may need to use:

    netsh firewall set service remoteadmin enable

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  3. #3


    HAL07 Guest

    Re: Connecting to Win32_DFSTarget on Windows Server 2008

    > Does it help to use authenticationLevel:

    >
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    > & strComputer & "\root\cimv2")
    >
    > If the script works on the server, but not remotely, then perhaps DCOM is
    > disabled. You may need to use:
    >
    > netsh firewall set service remoteadmin enable
    I tried both your script modification and the netsh. I even tried turning off the firewall and rebooted.
    But no result...

    Any clues?

      My System SpecsSystem Spec

  4. #4


    Richard Mueller [MVP] Guest

    Re: Connecting to Win32_DFSTarget on Windows Server 2008


    "HAL07" <yahoohal@xxxxxx> wrote in message
    news:uv$DxEFgJHA.3904@xxxxxx

    >> Does it help to use authenticationLevel:
    >>
    >> Set objWMIService = GetObject("winmgmts:" _
    >> & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    >> & strComputer & "\root\cimv2")
    >>
    >> If the script works on the server, but not remotely, then perhaps DCOM is
    >> disabled. You may need to use:
    >>
    >> netsh firewall set service remoteadmin enable
    >
    > I tried both your script modification and the netsh. I even tried turning
    > off the firewall and rebooted.
    > But no result...
    >
    > Any clues?
    I know of no reason why it should not work on W2k8. It is possible for WMI
    to become corrupt. I have used the following links to troubleshoot WMI:

    http://www.microsoft.com/technet/scr.../help/wmi.mspx

    http://support.microsoft.com/kb/875605

    http://www.microsoft.com/technet/scr...es/wmifaq.mspx

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  5. #5


    HAL07 Guest

    Re: Connecting to Win32_DFSTarget on Windows Server 2008

    >

    > I know of no reason why it should not work on W2k8. It is possible for WMI
    > to become corrupt. I have used the following links to troubleshoot WMI:
    >
    > http://www.microsoft.com/technet/scr.../help/wmi.mspx
    >
    > http://support.microsoft.com/kb/875605
    >
    > http://www.microsoft.com/technet/scr...es/wmifaq.mspx
    >
    I don't think so. I have no trouble doing this:
    Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_Service Where Name = 'DFSR' and State = 'Running'")

    it connects and I have output. So I wonder if the names of DFSR have somewhat changed the syntax in 2008?

    --
    -- HAL07, Engineering Services, Norway

      My System SpecsSystem Spec

Connecting to Win32_DFSTarget on Windows Server 2008 problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
RWW SBS 2008 error connecting to Terminal Server 2008 R2 Rodneym30 SBS Server 2 13 May 2010
Windows Hyper-V Server 2008 R2 with SBS 2008 running as guest Ringo SBS Server 2 08 Apr 2010
Sql server 2008 will not install on extra Windows 2008 server that comes with SBS 2008 john doe SBS Server 12 28 Dec 2009
Windows Small Business Server 2008 and Windows 2008 Standard Buz_69 SBS Server 6 27 Dec 2009
Error when installing SQL Express 2008 on Windows Server 2008 AngelDeLaNoche PowerShell 2 22 May 2009