If you are feeling a bit mischievous today, why not turn your co-worker’s computer into an audio replica of R2D2! Remotely edit their PowerShell profile and paste in the following code at the end of their profile:
function prompt { 20..40 | ForEach-Object { $frequency = Get-Random -Minimum 400 -Maximum 10000 $duration = Get-Random -Minimum 100 -Maximum 1000 [Console]::Beep($frequency, $duration) } }
The next time they launch PowerShell, their console will randomly make 21 beeps. Each beep is a random length and pitch.
The beeping function came from this great PowerShell resource. If you haven’t, consider subscribing to their blog for a daily PowerShell tip.
Have a fun Friday and aggravate teach some coworkers with this PowerShell prank.
I prefer this:
start-job {
[console]::beep(440,500)
[console]::beep(440,500)
[console]::beep(440,500)
[console]::beep(349,350)
[console]::beep(523,150)
[console]::beep(440,500)
[console]::beep(349,350)
[console]::beep(523,150)
[console]::beep(440,1000)
[console]::beep(659,500)
[console]::beep(659,500)
[console]::beep(659,500)
[console]::beep(698,350)
[console]::beep(523,150)
[console]::beep(415,500)
[console]::beep(349,350)
[console]::beep(523,150)
[console]::beep(440,1000)
}
Very nice Adam! 🙂
This doesn’t create between 20 and 40 beeps. It creates 21 beeps, one for each number 20 through 40.
Thanks for the correction! When I originally played with this, I used get-random to grab a random number.