Pop-up message using powershell

37,506

Use this for Windows 7/10:

msg console /server:localhost "Test message"

This will display message to console user when called from Remote PowerShell session.

Instead of console you can put any active session name from quser output.

You can also do it remotely (that is from local session) - just replace localhost with user's PC name or IP. Althrough this requires TCP port 445 to be open and editing AllowRemoteRPC registry key in some cases. Sample:

msg * /server:192.168.0.1 "Hello!"
Share:
37,506
C. Bogdan
Author by

C. Bogdan

Updated on December 02, 2022

Comments

  • C. Bogdan
    C. Bogdan over 1 year

    It's possible to display a pop-up message using PowerShell for remote users. I try this:

    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup("hello",0,"Done",0x1)
    

    but this code display local on my PC the pop-up window, and I want to run the PowerShell script on my PC and the pop-up message to be displayed where "abcuser" is logged on.

    • Mark Wragg
      Mark Wragg about 7 years
      I'm not sure if this is possible, I know powershell remoting creates an individual session for example so it wouldn't appear to the logged on user. But have you considered just using the old fashioned NET SEND ?
    • Anton Krouglov
      Anton Krouglov about 7 years
      @CBogdan You cannot do it via $wshell as it will never cross session boundary. User session and powershell remote session are isolated. To do UI-interaction between sessions either inject to user session via PSExec (or Task Scheduler) or use net send which is superseded by msg.exe in modern systems.
  • Pavel B.
    Pavel B. over 3 years
    Not working. Getting error 5 for all IPs. The computers are visible in network