Add-Type -AssemblyName System.Windows.Forms $Form = New-Object system.Windows.Forms.Form $Form.Text = "Sample Form" $Form.AutoScroll = $True $Form.width = 500 $Form.height = 300 $Form.AutoSize = $True #$Form.AutoSizeMode = "GrowAndShrink" # or GrowOnly $Form.MinimizeBox = $False $Form.MaximizeBox = $False $Form.WindowState = "Normal" # Maximized, Minimized, Normal $Form.SizeGripStyle = "Hide" # Auto, Hide, Show $Form.ShowInTaskbar = $False #$Form.Opacity = 0.7 # 1.0 is fully opaque; 0.0 is invisible $Form.BackColor = "Lime" # color names are static properties of System.Drawing.Color # you can also use ARGB values, such as "#FFFFEBCD" $Form.StartPosition = "CenterScreen" # CenterScreen, Manual, WindowsDefaultLocation, WindowsDefaultBounds, CenterParent $Form.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($PSHome + "\powershell.exe") #$Font = New-Object System.Drawing.Font("Times New Roman",24,[System.Drawing.FontStyle]::Italic) # Font styles are: Regular, Bold, Italic, Underline, Strikeout #$Form.Font = $Font $Label = New-Object System.Windows.Forms.Label $Label.Text = "This form is very simple." $Label.AutoSize = $True $Form.Controls.Add($Label) $OKButton = New-Object System.Windows.Forms.Button $OKButton.Location = New-Object System.Drawing.Size(75,120) $OKButton.Size = New-Object System.Drawing.Size(75,23) $OKButton.Text = "Get Service" $OKButton.Add_Click({$Form.Close()}) $Form.Controls.Add($OKButton) $Form.ShowDialog()