You can't with a MsgBox or a PopUp.
I would do it with a BalloonTip. This would make a good "PowerShell Quick
Script" article. Thanks for the idea.
[System.Reflection.Assembly]::LoadWithPartialName(
'System.Windows.Forms' ) | Out-Null
$balloonTip = New-Object System.Windows.Forms.NotifyIcon ## formal
name of a balloontrip is a "notifyIcon".
$balloonTip.Icon = [System.Drawing.SystemIcons]::Asterisk ## this is
the icon in the systray
$balloonTip.BalloonTipIcon = 'Info' ### Error, Info, None, Warning;
this is the icon in the balloon tip
$balloonTip.BalloonTipTitle = 'Please wait...' ### displayed in bold
$balloonTip.BalloonTipText = 'Building Listview...'
$balloonTip.Visible = $true
$balloonTip.ShowBalloonTip( 100000 ) ## in milliseconds, so this is
100 seconds
<<<go do stuff>>>
$balloonTip.Visible = $false
You can reuse the balloontip as many times as you want:
Update the title/text, set the Visible property back to true, and call
ShowBalloonTip() again.
When you are done with the variable, release it:
$balloonTip = $null
There are certainly other ways to do this, all of them will revolve around
using the Visible property on a form element.
Obligatory security comment: some people will tell you that using
LoadWithPartialName() is not secure, because the library is not strongly named
(no version number and no GUID). While strictly true, I consider the actual
risk miniscule.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Michael Leone
Sent: Thursday, October 2, 2014 1:45 PM
To: [email protected]
Subject: Re: [NTSysADM] Powershell - how to display a msgbox with no buttons
Thanks. But no, I read it twice, and still don't see how I can display a msgbox
with no buttons. Nor how to remove the window when I need to.
I don't know what those constant values are for, or what they actually control.
On Thu, Oct 2, 2014 at 1:31 PM, James Rankin <[email protected]> wrote:
> This blog post discusses using a msgbox in PowerShell, including some
> input from MBS that you may find helps do the "no buttons" thing
>
> http://appsensebigot.blogspot.co.uk/2013/10/case-study-ensuring-user-d
> oesnt-have.html
>
>
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1