Script to Send Reboot Message

Ryan Christensen 1 Reputation point
2021-04-02T17:47:11.83+00:00

Hello,

I am trying to figure out how to create a script (PowerShell or Bash) to send a message to multiple computers for the user to reboot at there earliest convenience to install updates. I would like a popup to stay on there desktop until they acknowledge it. I will be sending to multiple computers so if it could reference a text doc with the list of computers that would be great. I will open a Command Prompt or PowerShell with my admin account and run the script. All computers are Windows 10. Thank you for any help you can provide.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 96,926 Reputation points MVP
    2021-04-02T17:59:07.613+00:00

    HI @Ryan Christensen ,

    maybe this helps:

    https://techcognizance.com/2012/08/07/power-shell-script-to-send-message-to-network-computers-2/

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,891 Reputation points Microsoft Vendor
    2021-04-05T08:26:50.547+00:00

    Hi,

    You can try something like below

    $file = 'C:\tmp\com.txt'  
    $message = "Computer will be rebooted."  
    Get-Content -Path $file | ForEach-Object {  
            msg * /server:$_ $message  
        }  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments