$mailAddresses = ("sdasd@ddfsf.net","ououoizu@fdssd.com","ssdfdsfds@dsfds.org") function FnShowDialog { [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") #~~< Form1 >~~~~~~~~~~~~~~~~~~~~~~~~~~ $Form1 = New-Object System.Windows.Forms.Form $Form1.ClientSize = "347, 86" $Form1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif", 9.75, [System.Drawing.FontStyle]::Regular, [System.Drawing.GraphicsUnit]::Point, ([System.Byte](0))) $Form1.FormBorderStyle = "FixedToolWindow" $Form1.MaximizeBox = $false $Form1.MinimizeBox = $false $Form1.BackColor = "White" #~~< Label1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Label1 = New-Object System.Windows.Forms.Label $Label1.Location = "13, 13" $Label1.Size = "217, 23" $Label1.Text = "Bitte Mailadresse wählen:" #~~< Button1 >~~~~~~~~~~~~~~~~~~~~~~~~~ $Button1 = New-Object System.Windows.Forms.Button $Button1.Location = "259, 41" $Button1.Size = "76, 26" $Button1.Text = "OK" $Button1.add_MouseClick({ $script:selectedMailAdr = $ComboBox1.SelectedItem $Form1.dispose() }) #~~< ComboBox1 >~~~~~~~~~~~~~~~~~~~~~~~~~~ $ComboBox1 = New-Object System.Windows.Forms.ComboBox $ComboBox1.Location = "12, 40" $ComboBox1.SelectedIndex = -1 $ComboBox1.DropDownStyle = "DropDownList" $ComboBox1.Size = "231, 24" $ComboBox1.Items.AddRange($mailAddresses) $Form1.Controls.Add($Label1) $Form1.Controls.Add($Button1) $Form1.Controls.Add($ComboBox1) [System.Windows.Forms.Application]::Run($Form1) } FnShowDialog Write-Host $selectedMailAdr