Tiou
|
Message du 19-03-2008 @ 16:12
Quand vous lancez PowerOFF 3, sur la fenêtre principale dans le menu "Service", vous pouvez enregistrer PowerOFF en tant que service. Une fois que c'est fait, on peut utiliser PowerOFF en ligne de commande, et donc dans un fichier batch.
Avec PowerOFF est fourni un dossier doc. Il y a tout ce qu'il faut dans le fichier html, en particulier son usage en ligne de commande :
Citation 4 Command-line options
You can control every option and setting from the command-line. This makes poweroff excellent for use in batch files. Some options have changed since previous releases, so check your batch files! If you do poweroff /?, you will get an overview of all the options (look above for a description of all the settings):
Usage: poweroff action [options]
Actions: logoff, reboot, shutdown, poweroff, standby, hibernate, lock, wol, monitor_off, monitor_on or no_action
Options:
-warn : Show a warning message before doing the action
-warntime s : Show the warning message for s seconds
-playsound : Play a sound when the warning is displayed
-soundfile “f” : Specifies the .WAV file that must be played
-msg "m" : Specifies the warning message, use \n for a newline character
-force : Force applications to close
-wait s : Wait s seconds before checking the time
-remote m : Do the action on the remote machine m (name or ip)
-remschedule : Do the scheduling on the remote machine
-use_nt : Use the NT protocol to shutdown/reboot a remote machine
-port p : Use port p to connect to the remote machine
-username u : User NT username u to connect to the remote machine
-password p : Use password p to connect to the remote machine
-run : Run a program before doing the action
-program "p" : Runs program p before doing the action
-directory "d" : Start the program in directory d
-notray : Do not show poweroff icon in the system tray
-nocancel : Do not allow the user to cancel the action from the tray or in the warning dialog
-immediate : Perform the action immediately (default)
-scheduled : Perform the action in a scheduled manner
-time hh:mm : Perform the action at the specified time
-date dd/mm/yyyy: Perform the action on the specified date
-days [m,t,...] : Perform the action on the spcified days of the week (m,t,w,th,s,su)
-weeks [1,..,5] : Perform the action on the spcified weeks (default=all weeks)
-day d : Perform the action on the specified day of the month (1-31)
-seconds n : Perform the action after n seconds
-process p : Perform the action when a process named p does not exist anymore
-ip ip : Specifies the ip adress for WOL
-subnet s : Specifies the subnet mask for WOL
-mac m : Specifies the mac address for WOL
-allow_remote : Allow remote control
-remote_port p : Listen on port p for commands
-remote_pswd p : Set a password that clients must give for remote control
-simulate : Simulate all actions, do not perform them
-minimize : Start minimized in the system tray
-quiet : Don't display error messages
-save_settings : Saves current settings to the registry
-remove_settings: Remove the settings from the registry
-save_svc_set : Save current settings to the service
-remove_svc_set : Removes the service settings
-create_service : Creates the poweroff service, including the settings
-remove_service : Removes the poweroff service, including the settings
-debug : Start poweroff in debug mode
Exemple (dans mes souvenirs) pour éteindre le poste PC01 et afficher un message pendant 30 secondes avant l'extinction :
Poweroff Poweroff -remote PC01 (ou son IP) -username compte_utilisateur -password mot_de_passe -warn -warntime 30 -msg "Attention extinction de la machine"
Suffit de mettre cette ligne et les suivantes dans un fichier .BAT, et de faire une tâche planifiée sur un serveur pour que ce BAT soit executé à une heure donnée.
Pour allumer à distance une machine, c'est un peu plus compliqué, il faut se servir de l'adresse MAC de la machine, car une fois éteinte la pile TCP/IP n'est pas fonctionnelle. Il faut également que les switchs entre le serveur et les postes ne soit pas éteints depuis l'extinction des machines clientes. Et bien évidemment, que la carte mère gère bien le Wake On LAN, et qu'il soit bien activé dans le Bios.
Exemple pour allumer le PC01 :
Poweroff wol -ip adresse_IP -subnet masque_sous_réseau -mac adresse_MAC
[message édité le 19-03-2008 @ 16:18 Par Tiou]
|