Question about [System.Windows.MessageBox]

Welcome Forums General PowerShell Q&A Question about [System.Windows.MessageBox]

Viewing 2 reply threads
  • Author
    Posts
    • #223278
      Participant
      Topics: 1
      Replies: 0
      Points: 12
      Rank: Member

      Hello,

      being a beginning programmer in PowerShell, I have a script I can send a message to all workstations in a domain which are powered on and which are currently logged on.

      The message is being send as

      Invoke-WmiMethod -Path Win32_Process -Name Create -ArgumentList “msg * $msg” -ComputerName $comp | Out-Null

      but I would like to use the MessageBox.

      Is this possible and how?

      Any help is appreciated.

      Thx

      Philip

    • #223347
      Participant
      Topics: 12
      Replies: 1610
      Points: 2,508
      Helping Hand
      Rank: Community Hero

      What is “msg * $msg”? This appears that it is running a msg.exe on the client and sending a passed message? This code is starting a process on the remote client, but not sure what msg is?

    • #223395
      Participant
      Topics: 3
      Replies: 324
      Points: 1,056
      Helping Hand
      Rank: Community Hero

      MSG.exe is an old way to send network messages. It’s similar to how an admin would send shutdown message to users. There used to be a messenger service you had to enable.

      https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/msg

      What he’s doing with the * though is sending a message to all users of that particular computer, versus specifying a username, sessionname, sessionid. In my testing it always comes up as a message box already. What exactly are you seeing on the remote machines?

      Please note the following.

      1. You can use msg.exe natively, you don’t need to invoke a powershell command. Simply use msg /server:remotepc * 'message'
      2. You need administrative rights on the target nodes otherwise the message will be be sent to the local machine.

      I hope this helps.

       

Viewing 2 reply threads
  • You must be logged in to reply to this topic.