Ideas for popup

Welcome Forums General PowerShell Q&A Ideas for popup

This topic contains 2 replies, has 2 voices, and was last updated by

7 months ago.

  • Author
  • #105040

    Points: 82
    Rank: Member

    Hi guys.. not sure if this will even fall under PowerShell but I am looking for a way to display a simple popup with some contact information and IP address of the host.

    Currently, I am using 'Wscript.Shell' which is nice and fast but very limiting.

    Right now they are asking for a bunch of stuff that is not supported by this but I wanted to see if anyone had any better ideas.

    They are wanting to add a logo, hyperlink (support URL), copy to clipboard, and god only knows what else before it is approved.

    This is my script currently, but I was wondering if there was a better way, perhaps something like calling an IE window of a fixed size that contains this info and would allow images and hyperlinks etc...

    #Create Vars
    $Username = $env:USERNAME.ToUpper()
    $Computername = $env:COMPUTERNAME.ToUpper()
    $ComputerDomain = (Get-WmiObject win32_computersystem).Domain
    $IPAddress = ((Get-NetIPAddress -AddressFamily IPv4 -AddressState Preferred) | Where InterfaceAlias -NotMatch "Loopback*") -join ';   '
    $SCCMAgent = (Get-Service -DisplayName 'sms agent host').status
    $OS = (Get-CimInstance Win32_OperatingSystem).Caption
    $SDcontact = "http:\\"
    #Create Window and Collect Input
    $wshell = New-Object -ComObject Wscript.Shell
    $Answer = $wshell.Popup("IP Address:`t$IPAddress`n`nUsername:`t$Username`nComputer:`t$Computername`nDomain:`t`t$ComputerDomain`nSCCM Agent:`t$SccmAgent`nOS:`t`t$OS`n`nContact:`t`t$SDcontact`n`nWould you like to copy this information to the clipboard",0,"Title",4)
    #Check Answer
    If($Answer -eq "6"){
    Set-Clipboard -Value "IP Address: $IPAddress"
    Set-Clipboard -Value "Username: $Username" -Append
    Set-Clipboard -Value "Computer Name: $Computername" -Append
    Set-Clipboard -Value "Domain: $ComputerDomain" -Append
    Set-Clipboard -Value "SCCM Agent: $SCCMAgent" -Append
    Set-Clipboard -Value "OS: $OS" -Append
    #Popup provides enough time for the above to run.
    $wshell.Popup("Information has been copied to the clipboard",0,"Success",0)
  • #105047

    Points: 64
    Rank: Member

    Have a look at the link below. A WPF form may give you more options than calling $wshell.popup

    • #105125

      Points: 82
      Rank: Member

      Thanks. I think i'm on the right path now

The topic ‘Ideas for popup’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort