Jump to content

restart the computer.


 Share

Recommended Posts

hi,

does anyone know how can I write a script that restart a computer (win 2003 server), without using the controlsend or send function so it can run even if no one is logged on to the computer?

I need a routin restart every day at 00:00.

Thanks,

Link to comment
Share on other sites

  • Developers

Just schedule a "shutdown" command or if you really want a script to do it then use the Autoit3 Shutdown() command .. :D

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@all

Maybe just use what is already there.

SHUTDOWN.exe

Shutdown the computer

Syntax

SHUTDOWN [logoff_option] [/m \\Computer] [options]

logoff_option:

/i Display the GUI (must be the first option) /l Log off. This cannot be used with /m or /d option /s Shutdown /r Shutdown and Restart /a Abort a system shutdown. (only during the time-out period)

/p Turn off the local computer with no time-out or warning (only with /d) /h Hibernate the local computer (only with /f ) /e Document the reason for an unexpected shutdown of a computer

options:

/m \\Computer : A remote computer to shutdown.

/t:xxx : Time until system shutdown in seconds. The valid range is xxx=0-600 seconds. [default=30]

/c "Msg" : An optional shutdown message [Max 127 chars]

/f : Force running applications to close.

This will not prompt for File-Save in any open applications.

so will result in a loss of all unsaved data!!!

/d u:xx:yy : List a USER reason code for the shutdown.

/d P:xx:yy : List a PLANNED reason code for the shutdown.

xx Specifies the major reason code (0-255)

yy Specifies the minor reason code (0-65536)

Options in bold are for Windows 2003 onlyExample:

To create a desktop shortcut that will immediately shutdown your system - set the shortcut Target Properties to:

C:\Windows\System32\shutdown.exe -s

When using this command to reboot a server, the shutdown process will normally allow about 30 seconds to ensure each running service has time to stop. The shutdown can be made faster if all the services are first halted using NET STOP

e.g.

net stop "Microsoft Exchange Internet Mail Service"

net stop "Microsoft FTP Service"

net stop "Some other Service"

SHUTDOWN /t:25 /r

Regards,

ptrex

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...