Popup

Hi All,

need help
i created simple popup form and its working ok on local computer

function Create-SplashForm

{

# Form object
[Reflection.Assembly]::LoadWithPartialName('System') | Out-Null

[Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null

[Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null

[Reflection.Assembly]::LoadWithPartialName('mscorlib') | Out-Null

[Reflection.Assembly]::LoadWithPartialName('System.Data') | Out-Null

[Reflection.Assembly]::LoadWithPartialName('System.IO') | Out-Null

[Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null

[reflection.assembly]::LoadWithPartialName('System.DirectoryServices') | Out-Null


$script:frmMessage = New-Object System.Windows.Forms.Form

$lblTitle = New-Object System.Windows.Forms.Label

$objImage = New-Object System.Windows.Forms.PictureBox

$lblTextDown = New-Object System.Windows.Forms.Label

$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState



$frmMessage.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)

$System_Drawing_Size = New-Object System.Drawing.Size

$System_Drawing_Size.Height = 550

$System_Drawing_Size.Width = 500

$frmMessage.ClientSize = $System_Drawing_Size

$frmMessage.DataBindings.DefaultDataSourceUpdateMode = 0

$frmMessage.Name = 'frmMessage'

$frmMessage.StartPosition = 1
$frmMessage.MinimizeBox = 0
$frmMessage.MaximizeBox = 0


$frmMessage.Text = "Test form !!!"

# Save form

#InitialFormWindowState = $frmMessage.WindowState

#frmMessage.add_Load($OnLoadForm_StateCorrection)

# Show form

#$frmMessage.Show({ TopMost = true })| Out-Null

$frmMessage.Add_Shown({$frmMessage.Activate()})
$frmMessage.ShowDialog() | Out-Null

}
and to run:
Create-SplashForm
Start-Sleep -seconds 20
$frmMessage.Close()

i need help , how i can show this popup on remote comp. list

Thanks

You would need to push that script out to the remote computers, and then have the script run under the context of whatever user is logged on. Windows’ security boundaries don’t allow your to shove UI elements into another user’s space. If you could, the spammers would have windows popping up everywhere, all the time!

:wink: Thanks Don

what if i safe file as .ps
can i run it on remote comp with Invoke-Command ?

Thanks

You can run it, but a remote person can’t force a user interface element to pop up in another user’s run space, no. The user would have to run the script.

Windows is designed to not do what you’re wanting to do.

Ok,
Thank you Don for explanation

you may be able to use the local copy of msg.exe which is present in windows 7 assuming winrm has been configured correctly

see How to show remote notifications in PowerShell for some examples and how to configure winrm

If you are using Microsoft Lync 2010 in your environment you could send an instant message to a group of people

https://blogs.technet.microsoft.com/csps/2011/05/05/send-an-instant-message-from-a-script/

Thank you everyone,
i try , but this is what working for me
i try with Invoke-WmiMethod -Path Win32_Process and it’s working
now my problem when message popup it’s stay just for 15-20 sec and then disappear
and also i can’t add image in message

Thanks.

i try use psexec:
PsExec.exe -i \$comp PowerShell.exe -ExecutionPolicy Unrestricted -noprofile -nologo -noninteractive “\$script_path\Message.ps1”

but still not working