function Say-Time { [CmdletBinding()] param() # Get the current time $time = Get-Date -Format 'h:mm tt' # Use the System.Speech.Synthesis.SpeechSynthesizer class to speak the time Add-Type -AssemblyName System.Speech $synthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer $synthesizer.Speak($time) } Say-Time