Last active
November 13, 2019 16:46
-
-
Save johnallers/178576f097a8a7986fcb17a92c88a486 to your computer and use it in GitHub Desktop.
PowerShell - Speak random cat facts (https://www.reddit.com/r/PowerShell/comments/6550a7/using_powershell_for_office_pranks)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Run this every 1/2 hour and in an 8 hour work day there will be approximately 3 times per day that your victim hears a cat fact | |
if ((Get-Random -Maximum 10000) -lt 1875) { | |
Add-Type -AssemblyName System.Speech | |
$SpeechSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer | |
$CatFact = (ConvertFrom-Json (Invoke-WebRequest -Uri 'http://catfacts-api.appspot.com/api/facts')).facts | |
$SpeechSynth.Speak("did you know?") | |
$SpeechSynth.Speak($CatFact) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wrote an on-demand function for the fun of it.