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
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

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

shutdown /r  \\Computername

See all the commands here
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.
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?

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
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
            End With

any suggestions?
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.
All Courses

From novice to tech pro — start learning today.