views:

182

answers:

3

I inherited a script running on Windows Server 2003 that I need to port to Windows Server 2008. The current script is:

strComputer = "servernamexyz"  
Set objWMIService = GetObject("winmgmts:" _  
    & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _  
        strComputer & "\root\cimv2")  
Set colOperatingSystems = objWMIService.ExecQuery _  
    ("SELECT * FROM Win32_OperatingSystem")  
For Each objOperatingSystem in colOperatingSystems  
    objOperatingSystem.Win32Shutdown(12)  
Next

How do I convert this to run on Windows Server 2008? Thanks!

+1  A: 

There's nothing to translate. This works on Windows 2008 (both 32 and 64 bits).

jweyrich
+1  A: 

It's still present on server2008.

The Win32 label is a bit unfortunate, it wasn't the change from 16bit to 32bit memory that was the big thing in windows95 it was the switch to protected mode.
It's just that "32bit better than 16bit" was easier to explain in the ads - but it has left an awful lot of internal naming legacies with 64bit OSs.

Martin Beckett
ok, thanks. Looks like I'm chasing the wrong rabbit on this problem. It isn't working, so I'll have to dig a bit more - not sure why.
Jim
A: 

As noted above, the script was correct. The problem was with a firewall setting not allowing WMI from a remote computer. Thanks for the quick feedback. it enabled me to look in a different direction quickly. Sorry I cannot vote both of you up yet....

Jim