Last active
July 2, 2024 19:04
-
-
Save dpo007/c227a70bba39abc0184f9ce1a90a6bf5 to your computer and use it in GitHub Desktop.
PowerShell :: The Best Login Script Ever
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
# 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