From: HAL07 on
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/activmonitor/windowsmanagement/scripts/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
From: Richard Mueller [MVP] on

"HAL07" <yahoohal(a)online.yahoo.com> wrote in message
news:eop0X95fJHA.1292(a)TK2MSFTNGP02.phx.gbl...
>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/activmonitor/windowsmanagement/scripts/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
--


From: HAL07 on
> 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?
From: Richard Mueller [MVP] on

"HAL07" <yahoohal(a)online.yahoo.com> wrote in message
news:uv$DxEFgJHA.3904(a)TK2MSFTNGP02.phx.gbl...
>> 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/scriptcenter/topics/help/wmi.mspx

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

http://www.microsoft.com/technet/scriptcenter/resources/wmifaq.mspx

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


From: HAL07 on
>
> 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/scriptcenter/topics/help/wmi.mspx
>
> http://support.microsoft.com/kb/875605
>
> http://www.microsoft.com/technet/scriptcenter/resources/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
 | 
Pages: 1
Prev: Vbscript to Search Excel
Next: xcopy ftp