solution for scheduled defrag on pcs in the list and shutdown after defrag
Posted on 2009-07-08
Currently I have three different script:
1. First script will send out the magic packet to wake pcs
2. Second script will run the defrag for all the pcs that are listed in the text file using psexec
psexec @pc_list.txt -u administrator -p password -d -e defrag.exe c:
3. Finally using psshutdown from sysinteral to shut down pc listed int the text file.
psshutdown -u administrator -p password -s -c @pc_list.txt
I am using windows scheduler to run the script at night.
I think the current script doing quite well and very simple to use. However when i think of improving the script, pcs should shut down right after defrag is finished.
Wondering if there is easy way to improve the script so the pcs shut down right after defrag is finish.
if i don't use psexec to do remotely following script should work but can't figure out how to use with psexec.
defrag c: -f
shutdown -s -t 10 -f -c "Shutdown after defrag"