Re: Set previlege with Windows Management
From: Willy Denoyette [MVP] (willy.denoyette_at_pandora.be)
Date: 09/17/04
- Next message: Cor Ligthert: "Re: Dynamic forms?"
- Previous message: anya parker: "Re: > > > > stay away from eurobrides.com or be hacked and scammed matt parker alias e vonlint herzog matt parker alias erikvonlinthout matt parker alias c base matt parker alias a parker this statement is made in loving memory of the university empl"
- In reply to: David Shen: "Set previlege with Windows Management"
- Next in thread: David Shen: "Re: Set previlege with Windows Management"
- Reply: David Shen: "Re: Set previlege with Windows Management"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 10:14:02 +0200
Yes, setting EnablePrivilege to "true" should 'enable' all privileges
required to execute a specific WMI class methods.
Note that the principal must have been granted the required privilege (see
local security policies).
Note however that this fails when run on .NET v1.1 SP1.
Willy.
PS.Please post System.Management (WMI) related questions to
microsoft.public.dotnet.framework.wmi.
Willy.
"David Shen" <DavidShen@discussions.microsoft.com> wrote in message
news:7B40F4EF-9FFE-4BAE-A93E-8B6F05C902E7@microsoft.com...
> 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.
- Next message: Cor Ligthert: "Re: Dynamic forms?"
- Previous message: anya parker: "Re: > > > > stay away from eurobrides.com or be hacked and scammed matt parker alias e vonlint herzog matt parker alias erikvonlinthout matt parker alias c base matt parker alias a parker this statement is made in loving memory of the university empl"
- In reply to: David Shen: "Set previlege with Windows Management"
- Next in thread: David Shen: "Re: Set previlege with Windows Management"
- Reply: David Shen: "Re: Set previlege with Windows Management"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|