Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 891864 - Last Review: December 3, 2007 - Revision: 2.1
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
On This Page
SYMPTOMS
Consider the following scenario. You are running a Microsoft .NET Framework-based application in the .NET Framework 1.0 Service Pack 3 (SP3). 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 occurs only on a local computer. The behavior can
occur even if the
ConnectionOptions.EnablePrivileges property is set to
True.
RESOLUTION
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.0 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:09 1.0.3705.6031 30,720 Wminet_utils.dll
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed in the "Applies to" section.
MORE INFORMATION
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.0 Service
Pack 3 (SP3) 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 receive the error message that is mentioned in the "Symptoms" section.
REFERENCES
If you are running your application in the Microsoft .NET
Framework 1.1 Service Pack 1 (SP1), see the following article in Microsoft Knowledge
base:
891865Â
(http://kbalertz.com/Feedback.aspx?kbNumber=891865/
)
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.1 Service Pack 1
APPLIES TO
- Microsoft .NET Framework 1.0 Service Pack 3
| kbqfe kbhotfixserver kbbug kberrmsg kbcode kbfix KB891864 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please