In the previous tip we explained how you can add a personal greeting to your PowerShell profile. This greeting can also be spoken out, provided your volume is turned up. This works for all Powershell hosts including VSCode.
This will add the code to your profile script:
# create profile if it does not yet exist
$exists = Test-Path -Path $Profile.CurrentUserAllHosts
$null = New-Item -Path $Profile.CurrentUserAllHosts -ItemType File -Force
# add code to profile
'Glad to see you!',
'Have a great day!',
'May the PowerShell be with you!'
$text = $greetings | Get-Random
$null = (New-Object -COM Sapi.SpVoice).Speak($text)
'@ | Add-Content -Path $Profile.CurrentUserAllHosts -Encoding Default
To edit the profile, run this:
PS> notepad $profile.CurrentUserAllHosts
ReTweet this Tip!