February 20, 2015

Why speak your mind when ....

You can get your computer to do it for you!!!!

Now we all know the Grumpy IT Admin, is a lazy admin – when I did my Root Cause Hot Potato code it was quick and simple  – There was a step of automation that I had forgotten. We all know the Grumpy Admin is all for automation as it means he can do less work and drink more coffee! I only thought about this missing step from the why-crash function I wrote the other day, when we were talking about the old days, and when I used to get the old MSAgent in office 97 to say rude things in VBA! BING!!!! Why not add that function to the why-crash code I did yesterday for shits and giggles!!!

Now this will only work if you have a sound card and stuff, so typically your workstation not on your servers etc common sense guys! – and that you have your speakers on!! Lack of common sense makes me Grumpy!

Updated Why-Crash function – if your not sure what it is check the Root

Function why-crash {
Add-Type -AssemblyName System.Speech
$voice = New-Object System.Speech.Synthesis.SpeechSynthesizer
$data = Invoke-RestMethod -Uri “www.hazzy.co.uk/bofh/index.php”
write-host $data

The extra code added is

Add-Type -AssemblyName System.Speech
$voice = New-Object System.Speech.Synthesis.SpeechSynthesizer

A quick walk through of this new code for you – Add-Type – adds the built in speech thing from Windows – we all know Microsoft is big on speech these days – Hello Cortana!
Next line creates a new-object to use… sweet!
Then we call the speak function passing our returned quote (string) to the speech engine and all then you can make your office giggle!

You can now add speech elements to your Powershell scripts for string output – in case you have an administrator like Auggie” Anderson in Covert-Affairs! Don’t want to get caught by the dangle balls by the equality rights people now do we!