Programatically Restarting a Computer

Hi all,

Can someone let me know how I can programatically make the users computer restart (as it needs to do this after an install)
Many Thanks
kiranboiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
NoLimit99RBSCommented:
You can make a batch file (.bat) In it, put for example:

shutdown /r  \\Computername

See all the commands here
http://support.microsoft.com/kb/317371
0
 
NoLimit99RBSCommented:
I said batch file assuming you want to reboot more than one computer at once. If you just need to reboot one, you can do this from the command line.

You can also make this a scheduled task:

Control Panel >  scheduled tasks > add scheduled task.  Browse to the batch file, and click finish.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
kiranboiAuthor Commented:
i only need to shutdown one computer. just the one the user is logged on to at the time.

how can i do this from the command line? any chance of a code example?
thanks
0
 
NoLimit99RBSCommented:
Just

shutdown /r  \\Computername


Computername is the name of the computer you are sitting on. I think if you do "shutdown /r" without computer name, that should work as well.

/r is reboot
0
 
kiranboiAuthor Commented:
im still not clear how to implement this.i have tried the code below but it doesnt work:

Dim ps As New Process
            Dim psi As New ProcessStartInfo
            With psi
                .FileName = "cmd"
                .Arguments = "shutdown /r"
                .UseShellExecute = False
                .WindowStyle = ProcessWindowStyle.Hidden
            End With
            With ps
                .StartInfo = psi
                .Start()
                .WaitForExit()
            End With

any suggestions?
0
 
NoLimit99RBSCommented:
Oh, I just noticed you were referring to .NET.

I'm not too sure on that, but I will let you know what I find.
0
All Courses

From novice to tech pro — start learning today.