How to Shutdown or restart the remote system autometically

People from here, there and everywhere do not fear because Faizu Baba is here. As you all know that this blog always try to help you resolve your technology related issues. So I am back with another resolution. One of my friend asked me for a scheduled PC shutdown or restart. For which i have made a script which will help you schedule your shutdown or restart.

@ECHO OFF
PING 192.168.0.1 |FIND /I "TTL">NUL
IF NOT %ERRORLEVEL%==1 (
SHUTDOWN -s -f -m \\192.168.0.1 -t 60 -c "To abort system auto shutdown Click Start -> Run -> Cmd.exe -> OK -> shutdown a [Hit Enter]" >>C:\ShutResult.txt)
EXIT /B 0

What above script do is firstly it pings the system with stated IP address and when it will get the reply then this script will automatically shutdown this. But keeping this thing in mind that may be a user is using this system I have placed a comment that how to abort this process.
Now what you need to do is just copy and paste this script save it with a name shut.cmd or shut.bat. Now schedule this with windows task scheduler on any system and enjoy remotely shutdown of a system.

Note:
If you want to schedule a restart then just change the -s switch to -r and this script becomes the scheduled restart script.
This script is for remotely shutdown or restart the system.

After writing this script you have schedule it on windows task scheduler for which you have to follow following steps.
To open Scheduled Tasks, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.

To schedule a new task:

1. Double-click Add Scheduled Task to start the Scheduled Task Wizard, and then click Next in the first dialog box.
2. The next dialog box displays a list of programs that are installed on your computer, either as part of the Windows XP operating system, or as a result of software installation.

Use one of the following procedures:
* If the program that you want to run is listed, click the program, and then click Next.
* If you want to run a program, script, or document that is not listed, click Browse, click the folder and file that you want to schedule, and then click Open.
3. Type a name for the task, and then choose one of the following options:
* Daily
* Weekly
* Monthly
* One time only
* When my computer starts (before a user logs on)
* When I log on (only after the current user logs on)

4. Click Next, specify the information about the day and time to run the task, and then click Next.

Note that the information about the day and time to run the task vary depending on the selection that you made in the previous wizard dialog box. For example, if you chose Weekly, you must indicate the day of the week, the time, and if the task should run every week, every 2 weeks, every 3 weeks, and so on.
5. Type the name and password of the user who is associated with this task. Make sure that you choose a user with sufficient permissions to run the program. By default, the wizard selects the name of the user who is currently logged on.
6. Click Next, and then click Finish after you verify the choices that you have made.

Now leave all the things on the script.