Get Logged-In User and Send Messages
This PowerShell script allows you to get the user currently logged into a computer using the system account.
Get-WmiObject Win32_Process -f 'Name="explorer.exe"' |% getowner |% user
Send Message to Logged-In User
$sessionId = (Get-WmiObject Win32_Process -Filter 'Name="explorer.exe"').SessionId | Select-Object -Unique msg.exe $sessionId "$message"
0 Comments