I saw a bunch of closely related posts, so I know that I'm not alone, but no one has given me the answer I'm looking for. I apologize if they asked and answered about this, and I could not find him.
this script creates a custom notification area balloon, which, when clicked, is intended to open a new IE window for some URL. Works great with the PowerShell ISE GUI that I worked with. I can not get it to work from the command line using any parameters that I saw in other posts. In particular, IE cannot open the window for . The notification does not cause any problems, but there is no IE window ... ?? Tried using:
- powershell. script.ps1
- powershell -file script.ps1
- Team
- &
and etc.
Thoughts?
My script:
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
Remove-Event BalloonClicked_event -ea SilentlyContinue
Unregister-Event -SourceIdentifier BalloonClicked_event -ea silentlycontinue
Remove-Event BalloonClosed_event -ea SilentlyContinue
Unregister-Event -SourceIdentifier BalloonClosed_event -ea silentlycontinue
Remove-Event Disposed -ea SilentlyContinue
Unregister-Event -SourceIdentifier Disposed -ea silentlycontinue
$notification = New-Object System.Windows.Forms.NotifyIcon
$notification.Icon = [System.Drawing.SystemIcons]::Information
$notification.BalloonTipTitle = "**Reminder**"
$notification.BalloonTipIcon = "Warning"
$title = "message to user"
$notification.BalloonTipText = $title
$notification.Visible = $True
register-objectevent $notification BalloonTipClicked BalloonClicked_event -Action {
Start-Process 'c:\Program Files\Internet Explorer\iexplore.exe' -ArgumentList 'http://someURL.com' -WindowStyle Maximized -Verb Open
$notification.Dispose()
} | Out-Null
register-objectevent $notification BalloonTipClosed BalloonClosed_event -Action {$notification.Dispose()} | Out-Null
$notification.ShowBalloonTip(1000)
source
share