A script to Force a restart of a computer or computers on a network

If you wish to shut down a computer or all of the computers overnight on a network at a certain time there is a simple batch file you can write to do this. First i will show you the code then explain what each section means to allow you to manipulate it to work with your network. The code will need to be put in notepad and saved as a .bat file to allow it to run.

The Code

shutdown -r -m \\<computer name> -t 300 -c "This PC will restart in 5 minutes. Please save your work and log off now. Thanks.." -f

The green highlighted areas are the items you adapt to make the code your own. Each item is described below

The Code Explained

Firstly the comand is shutdown, using this command you can shutdown or restart the computer.. The -R refers to a restart as apposed to shutdown. The -m \\ <computer name> this is where you put the name of the computer you wish to restart. So if its call OfficeComputer this section would read -m \\Oficecomputer . The -T refers to the amont of time in seconds before the computer will restart. Then you can add a description that will appear in a popup on the computer before it restarts. This is included between the speach marks. The final option -F is used to force the restart of the computer even if applications are open.

If you open up a notepad file you can copy and paste this line of code for every computer in the office, making sure you change the computer name on each line to represent each computer. Once you have done this you can add it to the scheduled tasks to run at a certain time.




Disclaimer: By using any of the software mentioned in this document you are adhering to their terms and conditions of use. I do not accept any responsibility for any loss, damage or disruption to your data or computer system that may occur while using the software mentioned in this document.
Site Map | Privacy Policy | Contact Us
| Best viewed in 1024 * 768 or above | ©2008 www.MyPcHealth.co.uk