# load the necessary assemblies for gui stuff Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing # create the form (the custom window) $form = New-Object System.Windows.Forms.Form $form.Text = "catch me if you can :3" $form.Size = New-Object System.Drawing.Size(300, 150) $form.StartPosition = "Manual" $form.TopMost = $true # keeps it on top of other windows # add some text inside $label = New-Object System.Windows.Forms.Label $label.Text = "youareanidiot.cc" $label.Font = New-Object System.Drawing.Font("Arial", 12) $label.AutoSize = $true $label.Location = New-Object System.Drawing.Point(50, 40) $form.Controls.Add($label) # show the form properly $form.Show() # get screen dimensions $screenArgs = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea # loop while the form is still open while ($form.Visible) { # calculate random coordinates within screen bounds $maxX = $screenArgs.Width - $form.Width $maxY = $screenArgs.Height - $form.Height $randomX = Get-Random -Minimum 0 -Maximum $maxX $randomY = Get-Random -Minimum 0 -Maximum $maxY # move the form $form.Location = New-Object System.Drawing.Point($randomX, $randomY) # keep the window responsive [System.Windows.Forms.Application]::DoEvents() # wait 500ms Start-Sleep -Milliseconds 500 }