Home Tip of the day - Powershell for April first. Tricks and pranks Part 2
Post
Cancel

Tip of the day - Powershell for April first. Tricks and pranks Part 2

Tip of the day: Aprils Fools Day pranks with Powershell Part 2

Apply these pranks to your colleagues’ computers. They will be surprised and will have a good laugh.

Note: These pranks are harmless and will not cause any damage to the computer. They are just for fun.

Note: If you have any other ideas for pranks, please share them in the comments.

Most useful commands

Random Mouse Movements:

1
2
3
4
5
Add-Type -AssemblyName System.Windows.Forms
For ($i = 0; $i -lt 100; $i++) {
    [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point((Get-Random -Min 0 -Max 1920), (Get-Random -Min 0 -Max 1080))
    Start-Sleep -Milliseconds 500
}

Change the System Volume Randomly:

1
2
3
4
5
6
$volume = New-Object -ComObject WScript.Shell
For ($i = 0; $i -le 10; $i++) {
    $volume.SendKeys([char]175) # Volume Up
    Start-Sleep -Milliseconds 200
    $volume.SendKeys([char]174) # Volume Down
}

Narrator Announces Fake Updates:

1
2
3
Add-Type -AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Speak('Installing mandatory updates for Clippy, your helpful office assistant. Please do not turn off your computer.')

Random Error Message Pop-ups:

1
2
[Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.MessageBox]::Show('Error 404: Keyboard not found. Press F1 to continue.', 'System Error', [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)

Open a Random Website in the Default Browser Periodically:

1
2
3
4
5
$websites = @('http://example.com', 'http://example.org', 'http://example.net')
while ($true) {
    Start-Process (Get-Random -InputObject $websites)
    Start-Sleep -Seconds (Get-Random -Min 300 -Max 1800) # Randomly between 5 minutes to 30 minutes
}

Hide All Icons on Desktop:

1
2
3
4
$path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
Set-ItemProperty -Path $path -Name HideIcons -Value 1
Stop-Process -Name explorer -Force
Start-Process explorer

Change Desktop Background to a Funny Image:

1
2
3
# Ensure the path to the image is correct and accessible
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name Wallpaper -Value 'C:\path\to\funny-image.jpg'
RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters

Infinite Loop of notepad opening and closing:

1
2
3
4
5
6
while ($true) {
    Start-Process notepad
    Start-Sleep -Seconds 10
    Get-Process notepad | Stop-Process
    Start-Sleep -Seconds 5
}

If you missed the first part of the pranks, you can find them here > Tip of the day - Powershell for April first. Tricks and pranks.

This post is licensed under CC BY 4.0 by the author.

Download all files from array of URLs and archive them

Tip of the day - External Sharing Report for SharePoint Online Sites