Display a popup message on top

Using Powershell, display a popup message on top of other windows. This example waits for a computer to become online, then pops up a message to let you know.

[Powershell code]
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") > $null
$Computer = "srv3"
while (!(Test-Connection -ComputerName $Computer)) {start-sleep 10}
[System.Windows.MessageBox]::Show( (new-object System.Windows.Window -Property @{TopMost = $True}), `
"Computer is online`n`n$Computer","Search is over",0,64)

 

Leave a comment