473,750 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reboot?

sam
I found reboot script at TechNet and I wonder how to apply in VB.Net?

Reboot Coding
************
strComputer = "."
Set objWMIService = GetObject("winm gmts:" _
& "{impersonation Level=impersona te,(Shutdown)}! \\" & _
strComputer & "\root\cimv 2")
Set colOperatingSys tems = objWMIService.E xecQuery _
("SELECT * FROM Win32_Operating System")
For Each objOperatingSys tem in colOperatingSys tems
objOperatingSys tem.Reboot()
Next

Questions?
********
- What namespace that I need? System.Manageme nt?
- Will this coding work in VB.Net? How? What coding should add?
- Will it work at Windows Server 2003?

I need to reboot Windows Server 2003 to clear web cache and SQL cache for
better memory management.

Please advise.

Many thanks.
Nov 21 '05 #1
3 2222
sam,

I saw on Internet this page. I did not test it, my computer is very slow
shuting down and starting up.

:-)

http://www.mentalis.org/soft/class.qpx?id=7

Maybe it is something for you.

Cor
Nov 21 '05 #2
This should do the trick:

Public Sub RebootWindows()
Dim OpSysSet As Object
Dim OpSys As Object
OpSysSet =
GetObject("winm gmts:{impersona tionLevel=imper sonate,(ShutDow n)}").Instances O
f _("Win32_Operat ingSystem")
For Each OpSys In OpSysSet
OpSys.Reboot()
Next OpSys
End Sub

Hth Grtz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.
"sam" <sa*******@ajik l.com.my> schreef in bericht
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
I found reboot script at TechNet and I wonder how to apply in VB.Net?

Reboot Coding
************
strComputer = "."
Set objWMIService = GetObject("winm gmts:" _
& "{impersonation Level=impersona te,(Shutdown)}! \\" & _
strComputer & "\root\cimv 2")
Set colOperatingSys tems = objWMIService.E xecQuery _
("SELECT * FROM Win32_Operating System")
For Each objOperatingSys tem in colOperatingSys tems
objOperatingSys tem.Reboot()
Next

Questions?
********
- What namespace that I need? System.Manageme nt?
- Will this coding work in VB.Net? How? What coding should add?
- Will it work at Windows Server 2003?

I need to reboot Windows Server 2003 to clear web cache and SQL cache for
better memory management.

Please advise.

Many thanks.

Nov 21 '05 #3
- What namespace that I need? System.Manageme nt?
Yes
- Will this coding work in VB.Net? How? What coding should add?
I have not tried it , but I dont see why it will not
- Will it work at Windows Server 2003?
I dont have as server with me to try, but again it should.

One thing to note, is that all reboot/log off API need an adminstrator login
to work.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"sam" wrote:
I found reboot script at TechNet and I wonder how to apply in VB.Net?

Reboot Coding
************
strComputer = "."
Set objWMIService = GetObject("winm gmts:" _
& "{impersonation Level=impersona te,(Shutdown)}! \\" & _
strComputer & "\root\cimv 2")
Set colOperatingSys tems = objWMIService.E xecQuery _
("SELECT * FROM Win32_Operating System")
For Each objOperatingSys tem in colOperatingSys tems
objOperatingSys tem.Reboot()
Next

Questions?
********
- What namespace that I need? System.Manageme nt?
- Will this coding work in VB.Net? How? What coding should add?
- Will it work at Windows Server 2003?

I need to reboot Windows Server 2003 to clear web cache and SQL cache for
better memory management.

Please advise.

Many thanks.

Nov 21 '05 #4

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

Similar topics

8
4454
by: Ben Allen | last post by:
Is there a way (through a variable) to show the date of the last server reboot i.e. when PHP last started running? As I am trying to show the server uptime, which of course only works from the last reboot, therefore my %ages are very low. Cheers, Ben
6
4531
by: Stephane Dalpe | last post by:
Hi all, I just want to know why when I'm installing jdk sometimes ask me to reboot and sometimes he don't. As part of our installation, we launch the jdk installation if it's not already installed, so it's important to know when the user will be asked to reboot. Thanks
1
1591
by: ------------------ eric -------------------- | last post by:
Any idea how to reboot a givin machine useing the ststem.management namespace? thanks eric.
0
1291
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 application needs to reboot so I reboot and reboot and reboot again with the same result every time... Does anyone have a solution to this? Thanks
10
7295
by: JL | last post by:
To All, I have a SQL2KSP3a database(<1GB) running on a 4x3GB physical CPU with 4GB of ram. It is Windows Server 2003 with hyper-threading turn on. There are ~420 .Net users/cxns (fat client, no web/app servers) with connection pooling and ~1 trx/sec. The database growth is neglegeable and actually is not even relevent which I will explain in a minute. 99% of the trxs are from one SP that does a select. The resultsets are relatively...
1
1570
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 system and then say I need to install some prerequisite stuff. So I click on the link that says that and then I get a message the that some application is already requesting a reboot. This is a brand new Compaq laptop purchased yesterday. I have...
3
4014
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 advance Siju Maliakkal
2
4692
by: =?Utf-8?B?VHJhY2tz?= | last post by:
When I run my setup of a vb.net app made in VS2005 and setup made with the setup wizard and then modified in the ide, The .net 2 setup runs and installs and then asks to reboot. If you answer ok then the reboot happens and when the system comes back it says it cant find the setup1.msi file (my setup) and so wont continue and install my app. So how do I make it find setup1.msi and continue the setup after reboot (to setup my app) or even...
3
1696
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 AM with an unhandled exception on the screen. As best I can tell this exception occurs while it's trying to reboot the pc. This has me thinking it might be nice to have it do a reboot whenever it has an unhandled exception but then again I'm...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.