#Make sure to run as User #Upload logo to Gorelo and put path here if you want $logoPath = "$gorelo:file.Logo" $Title = "Company Remote Access" $Text = "Do you want to allow remote access?" Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing # Add necessary Windows API functions for window dragging Add-Type @" using System; using System.Runtime.InteropServices; public class NativeMethods { [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); } "@ # Constants $WM_NCLBUTTONDOWN = 0xA1 $HTCAPTION = 0x2 # Create the form $form = New-Object System.Windows.Forms.Form $form.FormBorderStyle = 'None' $form.Size = New-Object System.Drawing.Size(400, 120) $form.StartPosition = 'CenterScreen' $form.TopMost = $true $form.BackColor = [System.Drawing.Color]::White # Title bar $titleBar = New-Object System.Windows.Forms.Panel $titleBar.BackColor = 'DarkBlue' $titleBar.Size = New-Object System.Drawing.Size(400, 30) $titleBar.Dock = 'Top' $form.Controls.Add($titleBar) # Optional logo if (Test-Path $logoPath) { $logoBox = New-Object System.Windows.Forms.PictureBox $logoBox.Size = New-Object System.Drawing.Size(24, 24) $logoBox.Location = New-Object System.Drawing.Point(5, 3) $logoBox.Image = [System.Drawing.Image]::FromFile($logoPath) $logoBox.SizeMode = "StretchImage" $titleBar.Controls.Add($logoBox) } # Title label $titleLabel = New-Object System.Windows.Forms.Label $titleLabel.text = $Title $titleLabel.ForeColor = 'White' $titleLabel.Font = New-Object System.Drawing.Font("Segoe UI", 10, [System.Drawing.FontStyle]::Bold) $titleLabel.AutoSize = $true $titleLabel.Location = New-Object System.Drawing.Point(35, 7) $titleBar.Controls.Add($titleLabel) # Close button $closeButton = New-Object System.Windows.Forms.Button $closeButton.Text = "X" $closeButton.Size = New-Object System.Drawing.Size(30, 22) $closeButton.Location = New-Object System.Drawing.Point(360, 4) $closeButton.BackColor = 'White' $closeButton.Add_Click({ $form.Tag = "No";$form.Close() }) $titleBar.Controls.Add($closeButton) # Enable dragging by clicking the title bar $titleBar.Add_MouseDown({ [NativeMethods]::ReleaseCapture() | Out-Null [NativeMethods]::SendMessage($form.Handle, $WM_NCLBUTTONDOWN, $HTCAPTION, 0) | Out-Null }) # Body text $label = New-Object System.Windows.Forms.Label $label.Text = $text $label.AutoSize = $true $label.Location = New-Object System.Drawing.Point(70, 40) $label.Font = New-Object System.Drawing.Font("Segoe UI", 10) $form.Controls.Add($label) # Buttons $yesButton = New-Object System.Windows.Forms.Button $yesButton.Text = "Yes" $yesButton.Location = New-Object System.Drawing.Point(120, 80) $yesButton.Add_Click({ $form.Tag = "Yes"; $form.Close() }) $form.Controls.Add($yesButton) $noButton = New-Object System.Windows.Forms.Button $noButton.Text = "No" $noButton.Location = New-Object System.Drawing.Point(200, 80) $noButton.Add_Click({ $form.Tag = "No"; $form.Close() }) $form.Controls.Add($noButton) # Show and report result $form.ShowDialog() | Out-Null Write-Host "User selected: $($form.Tag)"