Make annoying beeps at random

Posted: April 26, 2012 in Scripts

The script below is designed to just really annoy the hell out of someone or scare the crap out of them as they wander around the server room looking for the offending equipment. Generates a random number of beeps (1-10 in this case), at a random interval between 20 and 100 secs. Imagine a room full of servers doing this!

While (0 -lt 1){
$rand = New-Object System.Random
ForEach ($Number in 1..$rand.next(1,11)){
Write-Host “`a”
}
Start-Sleep -Seconds $rand.next(20,101)
}

Expanding on that, this block adds in the function to for a file first, so you can get a bunch of machines running the sciprt but nothing will happen until the “trigger” file is created. So you get every server in your DC running this and then when some unsuspecting sys admin steps in, create the trigger file and watch them freak out!

While (0 -lt 1){
$rand = New-Object System.Random
If (Test-Path \\fileserver\public\trigger.txt){
ForEach ($Number in 1..$rand.next(1,11)){
Write-Host “`a”
}
}
Start-Sleep -Seconds $rand.next(20,101)
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s