Popup

This topic contains 8 replies, has 3 voices, and was last updated by  Brad 2 weeks ago.

  • Author
    Posts
  • #76366

    Brad
    Participant

    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

  • #76373

    Don Jones
    Keymaster

    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!

  • #76376

    Brad
    Participant

    😉 Thanks Don

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

    Thanks

  • #76382

    Don Jones
    Keymaster

    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.

  • #76384

    Brad
    Participant

    Ok,
    Thank you Don for explanation

  • #76405

    Simon B
    Participant

    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 http://quickbytesstuff.blogspot.co.uk/2014/05/how-to-show-remote-notifications-in.html for some examples and how to configure winrm

  • #76406

    Simon B
    Participant

    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/

  • #76457

    Brad
    Participant

    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.

  • #76486

    Brad
    Participant

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

    but still not working

You must be logged in to reply to this topic.