I have a powershell logon script via GPO. I would like to show a form when the script runs. Works great from the ISE but doesn’t do anything during the logon script.
Thanks for any help!
Add-Type -AssemblyName System.Windows.Forms
$form = New-Object System.Windows.Forms.Form
$form.Text = ""
$form.Size = New-Object System.Drawing.Size(400, 800) #width, height
$form.Font = New-Object System.Drawing.Font("Comic Sans MS",16,[System.Drawing.FontStyle]::Regular)
$form.MinimizeBox = $False
$form.MaximizeBox = $False
$form.WindowState = "Normal" #Maximized, Minimized, Normal
$form.SizeGripStyle = "Hide" #Auto, Hide, Show
$form.ShowInTaskbar = $False
$form.Opacity = 1.0 #1.0 is fully opaque; 0.0 is invisible
$form.StartPosition = "CenterScreen" # CenterScreen, Manual, WindowsDefaultLocation, WindowsDefaultBounds, CenterParent
$label1 = New-Object System.Windows.Forms.label
$label1.BackColor = "Transparent"
$label1.BorderStyle = "None"
$label1.Location = New-Object System.Drawing.Point(1, 375) #left, top
$label1.Text = "Test Line 1"
$label1.TextAlign = "MiddleCenter"
$label1.Width = 800
$form.Controls.Add($label1)
$form.ShowDialog()