Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@steviecoaster
Created August 30, 2019 02:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steviecoaster/a9cb2794f1ee0440dcf70d2194875ef2 to your computer and use it in GitHub Desktop.
Save steviecoaster/a9cb2794f1ee0440dcf70d2194875ef2 to your computer and use it in GitHub Desktop.
Get-DadJokes.....WITH SOUND!!!!
function Get-DadJoke {
[cmdletBinding()]
Param()
process {
$header = @{
Accept = "application/json"
}
$joke = Invoke-RestMethod -Uri "https://icanhazdadjoke.com/" -Method Get -Headers $header
Add-Type -AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Speak("$($joke.joke)")
}
}
@stevenjudd
Copy link

Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment