Skip to content

Instantly share code, notes, and snippets.

@dpo007
Last active November 2, 2023 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpo007/c227a70bba39abc0184f9ce1a90a6bf5 to your computer and use it in GitHub Desktop.
Save dpo007/c227a70bba39abc0184f9ce1a90a6bf5 to your computer and use it in GitHub Desktop.
PowerShell :: The Best Login Script Ever
# Get random cat fact from API
$catFact = Invoke-RestMethod -Uri "https://catfact.ninja/fact" -Method Get
# Print cat fact
Write-Host $catFact.fact
# Setup speech synthesizer
Add-Type -AssemblyName System.Speech
$speech = New-Object System.Speech.Synthesis.SpeechSynthesizer
# Get list of installed Voices
$voices = $speech.GetInstalledVoices().VoiceInfo
# Pick random voice from list
$voice = $voices | Get-Random
# Set the voice
$speech.SelectVoice($voice.Name)
# Speak the cat fact
$speech.Speak($catFact.fact)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment