473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Problem of Reboot in WMI application

Hi,
I am writing a console application using WMI with C# . Development is for
Windows XP machine. One of the methods requires to reboot the local
terminal.

In my application I make a call to the Reboot method of the
Win32_OperatingSystem class.
Even though I am the local administrator on this system which is a Windows
XP machine ..
Trying this out on the Domain administrator's PC with his login also didnt
work.
I get an error message .

I give the code as well as the error message below.
..............Code ...............................
ManagementClass objMC = new ManagementClass(

"Win32_OperatingSystem");

ManagementObjectCollection objMOC = objMC.GetInstances();
foreach(ManagementObject objMO in objMOC)

{

ManagementBaseObject iPar = null;

bool EnablePriviledge = objMO.Scope.Options.EnablePrivileges;

objMO.Scope.Options.EnablePrivileges =true;

ManagementBaseObject outPar = objMO.InvokeMethod("Reboot",iPar,null);

}

------------------------------------
Error Message...

System.Management.ManagementException: Privilege not held.
at
System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStat
us errorCode)
at System.Management.ManagementObject.InvokeMethod(St ring methodName,
Managem
entBaseObject inParameters, InvokeMethodOptions options)
at Aloha.RAL.CConfigTerm.get_RebootTerminal() in
E:\Projects\Radiants\Remote
Application Loader\WF\Aloha\Aloha.RAL\ConfigTerm.cs:line 126
--------------------------------------------------------
Links url :
for Win32_OperatingSystem

http://msdn.microsoft.com/library/de...us/wmisdk/wmi/
win32_operatingsystem.asp

for Reboot method
http://msdn.microsoft.com/library/de...us/wmisdk/wmi/
reboot_method_in_class_win32_operatingsystem.asp
thanks for any help

regards
Manoj
Nov 16 '05 #1
0 1457

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wolfgang Kaml | last post by:
Hello All, I have been researching newsgroups and knowledgebase all morning and not found a solution that would solve the problem I have. I am having an ASP or ASPX web page that implement a...
0
by: ThunderMusic | last post by:
Hi, I'm trying to install VS.NET 2003 and it keeps asking me to reboot the computer for installing the first step. After rebooting, I try to install the first step, then it tells me again an...
4
by: ja | last post by:
Hello, When I run the following query: select count(*) from table111 where pf = 'F' and pet = 'Y' I get the following error message:
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
2
by: Beenish Sahar Khan | last post by:
Hello, I am developing an application in C#, which was previously in .Net 2005 Beta, then it was working perfectly fine, but from the time I have upgraded it to .Net 2005 Professional, its...
1
by: Aaron | last post by:
Not sure if this is the best spot to post this question, but I am not going to pay money to ask an installation question.... Anyways I am trying to install C# standard 2003 and it analyzes the...
3
by: iamsiju | last post by:
Hi, I am facing a problem with the Perl Telnet Object. My Telnet Object hangs just after issueing reboot command on the remote host. Please help me who faced this problem !!! Thanks in...
5
by: lamxing | last post by:
Hi, I've come across a strange problem with the WinForm's sizing. I've designed a WinForm and it runs fine on my computer and some other PCs. But when I was trying to run the app under some PCs...
3
by: cj | last post by:
My program shuts itself down and reboots the pc it's running on at 2:00am twice a week and has been doing so without fail for over a year. But twice in the past month it's been found running in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.