Thinkgeek Annoy-a-Trons are the coolest. My first encounter with one of these devices was in a previous life, working as a helpdesk lead at an energy company. One of our SharePoint clerks placed one of these little buggers in my office. At first I didn’t notice, and it wasn’t until lunch time where I realized this thing was beeping at me. Since then I have deployed countless annoy-a-trons.
After doing some digging, I was looking at deploying these as-code on a computer remotely computer.
The basic code below will initiate the beeping mechanism, but it doesn’t solve the remote code deployment:
do {
$timer = Get-Random -Minimum 15 -Maximum 600
$length = Get-Random -Minimum 500 -Maximum 10000
Start-Sleep $timer
[console]::beep(14000,$length)
} while ($true)
Below is some crude PS Code that does the trick in a domain environment, but you need elevated perms on the machine and WSMan needs to be enabled:
$targetcomputer = hostname
$opt = New-ScheduledJobOption -HideInTaskScheduler -ContinueIfGoingOnBattery -MultipleInstancePolicy StopExisting
$trig = New-JobTrigger -AtStartup
Invoke-Command -ComputerName $targetcomputer -Credential $cred -ScriptBlock {Register-ScheduledJob -name '>:-)' -Trigger $trig -ScheduledJobOption $opt -scriptblock {
Start-job -ScriptBlock {
do {
$timer = Get-Random -Minimum 45 -Maximum 600
$length = Get-Random -Minimum 500 -Maximum 10000
Start-Sleep $timer
[console]::beep(15000,$length)
} while ($true)
}
}