Home > Software design >  How to send notifications or messages to user?
How to send notifications or messages to user?

Time:03-16

I have a script that runs in the current user space, but in the background, permanently minimized.

It needs to send notifications, via the system tray, or Windows.UI.Notifications mechanism (or something else of this flavor).

How is this done in powershell on Win11/Win10?

CodePudding user response:

# this can be a manual input array of users as well
$users = ((Get-WMIObject -ClassName Win32_ComputerSystem).Username).Split('\')[1]
$WhatToSend = Read-Host "What do you want the message to be"
foreach ($user in $users){
    & msg $user $WhatToSend
}
#if you want to send the message to all users then use a wildcard
msg * $WhatToSend

CodePudding user response:

I think the Toast

  • Related