G
Guest
Hi,
Here is text copy/paste from the WMI SDK reference
Use the Win32_OperatingSystem class and the Win32Shutdown method. You must
include the RemoteShutdown privilege when connecting to WMI. For more
information, see Executing Privileged Operations. Unlike the Shutdown method
on Win32_OperatingSystem, the Win32Shutdown method allows you to set flags to
control the shutdown behavior.
strComputer = "atl-dc-01"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Shutdown(1)
Next
My question is what is the equivalent of
"{impersonationLevel=impersonate,(Shutdown)}!\\" in .NET/C#. Is setting
EnablePrivilege = true good enough?
Thanks.
Here is text copy/paste from the WMI SDK reference
Use the Win32_OperatingSystem class and the Win32Shutdown method. You must
include the RemoteShutdown privilege when connecting to WMI. For more
information, see Executing Privileged Operations. Unlike the Shutdown method
on Win32_OperatingSystem, the Win32Shutdown method allows you to set flags to
control the shutdown behavior.
strComputer = "atl-dc-01"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Shutdown(1)
Next
My question is what is the equivalent of
"{impersonationLevel=impersonate,(Shutdown)}!\\" in .NET/C#. Is setting
EnablePrivilege = true good enough?
Thanks.