jennico Posted May 25, 2008 Posted May 25, 2008 (edited) hi there. working on a script that automatically backups files from my server and is supposed to power off the server at the end (want to save energy during the night). so of course i tried shutdown.exe which works fine but it does not power off server, only shutdown, meaning that the server still wastes energy in the night. RunWait('shutdown -s -f -m \\server1 -t 20 -c "Datensicherung von Büro"',"",@SW_HIDE) shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536) btw.: my server powers off correctly when you go the normal start-clicking way. so why it doesn't on (remote) shutdown command ? i have found an interesting open source prog that claims to be able to do this: PowerOff 3.0 it can be controlled via command lines and thus integrated in my script. but maybe anyone knows how to manage that without a second tool ? maybe i just miss a hidden option in the options panel ? please answer ! j. Edited May 26, 2008 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
Danny35d Posted May 25, 2008 Posted May 25, 2008 Looking at your script you are using shutdown with -r switch which mean shutdown and restart the computer. Replaced -r for -s to shutdown or power off the computer. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
jennico Posted May 26, 2008 Author Posted May 26, 2008 (edited) ooops ! sorry, copied the wrong line. of course i use -s instead of -r. problem remains the same. makes a shutdown, but no poweroff. maybe some of you can try that out in their networks and tell me if any pc is really powered off, then "shutdown.exe" is not the problem and we could compare the server settings, just a thought.... j. Edited May 26, 2008 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
rudi Posted May 26, 2008 Posted May 26, 2008 (edited) ooops ! sorry, copied the wrong line. of course i use -s instead of -r. problem remains the same. makes a shutdown, but no poweroff. maybe some of you can try that out in their networks and tell me if any pc is really powered off, then "shutdown.exe" is not the problem and we could compare the server settings, just a thought.... j. Use the Autoit Function Shutdown() and PSTools to trigger it remotely. [edit] You backup your server's data to a workstation? Somewhat ugly <scnr> If you push the data from the server instead of pulling them from the WS you can run the mentioned autoit script local to the server after the push completed. [/edit] Valid Values are: 0 = Logoff 1 = Shutdown 2 = Reboot 4 = Force 8 = Power down 32= Standby 64= Hibernate For your purpose you might want to use 1 + 4 + 8 = 13. [edit - strike] Keep in mind, that the backup software might *NOT* be finally done just after the backup job itself is finished: If you force a shutdown during the merge of the job info to the Backup Database, your chances are "good" to corrupt the restore database. IMHO servers should run 24h a day[1]. A shutdown for the weekend or during holidays might be making sense. [edit] btw: current version of autoit is 3.2.12.0 Regards, Rudi. [1] Da weint zwar mein grünes Herz, aber sicher ist sicher Edited May 26, 2008 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
jennico Posted May 26, 2008 Author Posted May 26, 2008 (edited) version 3.2.10.0 hab ich wieder deinstalliert, definitiv zu viele fehler und die alten scripts laufen nicht mehr. die includes hab ich tlws. behalten. das war wohl nix !!! warte schon seit 6 monaten auf bugfixes.....well theres no need to discuss why i do what i want to do. i want a server backup on every workstation every night because some people like to steal my pcs but they wont be able to steal them all. and the server has to be powered off over night because its a lousy ancient industry standard ibm machine and so dirty noisy that the neighbours dont get sleep. i cannot exchange the machine because they sell their business program only readily installed on a server so they can prevent distribution. i dont even have the permission to install tools on this server unless i want to loose their software support ............ well, they make the rules...i will try ps tools not sure if it is able to power off.btw i can power off the server by remote desktop....j.edit: thx for the idea to execute the program on the server, in this case i could use the shutdown function. but the script has to be controlled from the workstation. ... is it possible to open a second script on the server (containing shutdown) from a workstation ? run ? execute ? i will try that. Edited May 26, 2008 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
jennico Posted May 26, 2008 Author Posted May 26, 2008 (edited) okay, pstools seem to do the job. thx a lot !!!! but the other idea: only using autoit, how can i launch a remote script ? possible ?jEdit: found an interesting link. Edited May 26, 2008 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
jennico Posted March 7, 2009 Author Posted March 7, 2009 finally i found the solution how to completely poweroff (not only shutdown) a server (with xp, w2k server or w2003 server running, vista i don't know) from a client pc. without extra tools on server. 1st solution: with psexec: psshutdown.exe in scriptdir or systemdir of client. needs username and password $Hostname="Server" $User="Username" $Password="Password" Run("psshutdown -u "&$User&" -p "&$Password&" -f -k \\"&$Hostname) ExitoÝ÷ Ûiݲn¶*'Â+an襶)Û¶Ë!º×gý½÷ß}÷ßyè¢Ø^®Ú(·ªº*Þvë®v¦y©Ý¥«,ÂÝkz«¢çZºÚ"µÍÌÍÒÜÝ[YOI][ÝÔÙ][ÝÂ[ ][ÝÕÔÒUÔÑTT][ÝÉ[ÉÌÍÒÜÝ[YI[É][ÝÈÔÕÑTÕÓÑSVNÕ][ÝÊB^] the 2nd is the better solution. tsshutdn is specially designed to shutdown terminal servers. the documentation: Syntax TSSHUTDN /? TSSHUTDN [wait_time] [/server:server_name] [/reboot] [/powerdown] [/delay:log_off_delay] [/v] -------------------------------------------------------------------------------- Parameters wait_time (NT2000) Specify the time period to wait (after users are notified) after which users are logged off from their sessions. The default setting is 60 seconds. -------------------------------------------------------------------------------- Switches /? (NT2000) Displays help. /delay:log_off_delay (NT2000) Specify the time period to wait (after users are logged off from their sessions) after which all processes end and the Terminal server shuts down. The default setting is 30 seconds. /powerdown (NT2000) Turn off the Terminal server (if the computer supports Advanced Power Management). /reboot (NT2000) Shut down and restart the Terminal server after client sessions are ended. /server:server_name (NT2000) Specify the Terminal server that you want to shut down. The default setting is to shut down the current Terminal server. /v (NT2000) Display information about the actions that are performed. i admit, this seems to be a severe security leak, but anyway, it' there and working. you could heavily annoy your boss by executing this on your client pc ! things that are not working: - shutdown.exe - Shutdown() command by autoit - any manipulation on the WMI level (Win32ShutDown) - commands via tcp/ip (needs a receiver running on server) it was hard to find, so i think it might be useful to share that knowledge. cheers j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
jennico Posted March 13, 2009 Author Posted March 13, 2009 a last addition to that:tsshutdn has no ability to force the shutdown. but there is another tool which can be run right before:tskill kills any process on a terminal server !j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now