Consider the following scenario. You are running a Microsoft .NET Framework-based application in the .NET Framework 1.1 Service Pack 1 (SP1). You execute some Windows Management
Instrumentation (WMI) operations that require privileges to be enabled. For example, you shut down or restart a local computer by using the
System.Management
namespace. Or, you may call the
ManagementEventWatcher.Start method.
In this scenario, you receive the following error message:
An unhandled
exception of type 'System.Management.ManagementException' occurred in
system.management.dll Additional information: Privilege not held.
This behavior only occurs on a local computer. This behavior can occur even if the
ConnectionOptions.EnablePrivileges property is set to
True.
Back to the top
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework 1.1 service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the
Time Zone tab in the Date and Time tool in Control Panel.
Date Time Version Size File name
-----------------------------------------------------------
07-Jan-2005 04:46 1.1.4322.2062 32,256 Wminet_utils.dll
Back to the top
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed in the "Applies to" section.
Back to the top
Steps to reproduce the behavior
To reproduce this problem, build and then run the following Microsoft Visual
Basic .NET code example on a Microsoft Windows XP-based computer that has the .NET Framework 1.1 Service
Pack 1 (SP1) installed.
Imports System.Management
Module Module1
Sub Main()
Dim result As Int32
result = 0
Dim scope As New Management.ManagementScope("\\.\root\cimv2")
scope.Options.EnablePrivileges = True
scope.Connect()
Dim objQuery As New System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem")
Dim objSearcher As New Management.ManagementObjectSearcher(scope, objQuery)
Dim objCol As Management.ManagementObjectCollection = objSearcher.Get()
Dim mo As Management.ManagementObject
For Each mo In objCol
Dim methodArgs As String() = {"6", "0"} //Forced Reboot
mo.InvokeMethod("Win32Shutdown", methodArgs)
Console.WriteLine(mo.ToString())
Next
End Sub
End ModuleYou will receive the error message that is mentioned in the "Symptoms"
section.
Back to the top
If you are running your application in the Microsoft .NET
Framework 1.0 Service Pack 3 (SP3), see the following article in Microsoft Knowledge
base:
891864 (http://kbalertz.com/Feedback.aspx?kbNumber=891864/) FIX: You receive a "Privilege not held" error message when you execute WMI operations by using the System.Management namespace in the .NET Framework 1.0 Service Pack 3
Back to the top