Powershell script to reboot Windows Servers

Tagged: 

Viewing 2 reply threads
  • Author
    Posts
    • #1558797
      Mark
      Participant
      Member Points: 692
      Rank: 2

      Hello,

      Could anyone please let me know how to implement a PowerShell script which takes input from a text file consisting of servers and reboot all of them simultaneously?

      After reboot is completed, I need to output a file to determine whether the reboot has been successfully completed for each and every server.

      Environment: Windows 2008, Windows 2012 R2, Windows Server 2016 and 2019.

      Thanks.

      avatar
    • #1558815
      Jim Bendtsen
      Participant
      Member Points: 264
      Rank: 2

      Hopefully, you have done some research on the various parts you need to assemble to do this, and aren’t simply asking someone to write a complete script for you.

      create the file

      get-content from it

      foreach server in serverlist

      create pssession to restart locally or

      restart-computer -computer to do it remotely.

      | tee output

      There are lots of examples out there. Try them.

       

      avatar
      • #1558816
        Leos Marek
        Moderator
        Member Points: 24,986
        Author of Year 2020Author of the Year 2021
        Rank: 4

        Restart-Computer -Wait is what you need. As Jim said its a very simple script that you can find on multiple places.

    • #1559047
      Leos Marek
      Moderator
      Member Points: 24,986
      Author of Year 2020Author of the Year 2021
      Rank: 4

      Hi Mark,

      did you succeed in your script?

      L

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account