Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Connecting to Win32_DFSTarget on Windows Server 2008

Reply
 
Old 01-26-2009   #1 (permalink)
HAL07


 
 

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
Old 01-26-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Connecting to Win32_DFSTarget on Windows Server 2008


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

>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
Old 01-27-2009   #3 (permalink)
HAL07


 
 

Re: Connecting to Win32_DFSTarget on Windows Server 2008

> Does it help to use authenticationLevel:
Quote:

>
> 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
Old 01-27-2009   #4 (permalink)
Richard Mueller [MVP]


 
 

Re: Connecting to Win32_DFSTarget on Windows Server 2008


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

>> 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
Old 01-28-2009   #5 (permalink)
HAL07


 
 

Re: Connecting to Win32_DFSTarget on Windows Server 2008

>
Quote:

> 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
Reply

Thread Tools


Similar Threads
Thread Forum
Error when installing SQL Express 2008 on Windows Server 2008 PowerShell
Windows Server 2008 hosted on Virtual Server 2005 R2 very slow Virtual Server
Cna't Install Windows Server 2008 under Virtual Server SP1 Virtual Server
Error installing Windows Server 2008 as Virtual Server Virtual Server
Bug: Windows Modules Service Is Broken In Windows Server 2008 Beta 3 Web Server Addition. Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46