rebooting multiple computer

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 3 months ago.

  • Author
    Posts
  • #5368

    by Ashtonnew at 2012-12-18 20:34:12

    How can I write a script to reboot multiple computer and write successful and unsuccessful information to a csv file?

    by DexterPOSH at 2012-12-19 03:23:27

    Hi Ashtonnew,

    "Restart-Computer" cmdlet is your friend here.

    Cheers
    ~Dexter~

    by RichardSiddaway at 2012-12-19 08:01:42

    "computer1", "computer2", "computer3" | restart-computer -force

    will do the restart for you. if you want to know if its successful you'll need to either ping it to watch it disappear and comeback or check the event logs

    by Ashtonnew at 2012-12-19 09:06:39

    yes , thanks . How can I add in the script that the reboot were successful, I am adding get-content from a csv file with the list of computers to the script.

    by DexterPOSH at 2013-02-27 08:06:38

    Sorry,

    I saw this thread after a long time....As pointed above by Richard Sir.
    After restarting the machine...you can use the cmdlet Test-Connection as below:
    Test-Connection -ComputerName servername -Count 2 -Quiet
    This will give you a True/False value which will probably go inside an if condition.

    Hope this makes sense

    by DonJ at 2013-02-27 08:10:44

    In PowerShell v3, you can also use the -wait parameter of Restart-Computer.

You must be logged in to reply to this topic.