[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing"); [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms"); $objForm = New-Object System.Windows.Forms.Form; # Removes the minimize, maximize and exit boxes from the top of the form. $objForm.ControlBox = $False $objForm.Text = "Security and Legal Notice"; $objForm.Size = New-Object System.Drawing.Size(640,480); $objForm.StartPosition = "CenterScreen"; $objForm.KeyPreview = $True; $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter") {$objForm.Close()}}) $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape") {$objForm.Close();logoff}}) $OKButton = New-Object System.Windows.Forms.Button; $OKButton.Location = New-Object System.Drawing.Size(250,400); $OKButton.Size = New-Object System.Drawing.Size(75,23); $OKButton.Text = "OK"; $OKButton.Add_Click({$objForm.Close()}); $objForm.Controls.Add($OKButton); $CancelButton = New-Object System.Windows.Forms.Button; $CancelButton.Location = New-Object System.Drawing.Size(325,400); $CancelButton.Size = New-Object System.Drawing.Size(75,23); $CancelButton.Text = "Logoff"; $CancelButton.Add_Click({$objForm.Close();logoff}); $objForm.Controls.Add($CancelButton); $objLabel = New-Object System.Windows.Forms.Label; $objLabel.Location = New-Object System.Drawing.Size(10,20); $objLabel.Size = New-Object System.Drawing.Size(600,400); $objLabel.Text = "You are accessing a restricted system for official use only. By selecting OK you agree to abide by all organizational security policies. Do not allow unauthorized personnel to access this system." $objForm.Controls.Add($objLabel); $objForm.Topmost = $True; $objForm.Add_Shown({$objForm.Activate()}); [void] $objForm.ShowDialog();