Skip to content

Instantly share code, notes, and snippets.

@devhawk
Created May 14, 2020 18:13
Show Gist options
  • Save devhawk/ad5f493dfda9edac2216d41d3fc43dd5 to your computer and use it in GitHub Desktop.
Save devhawk/ad5f493dfda9edac2216d41d3fc43dd5 to your computer and use it in GitHub Desktop.
Update the start menu Windows PowerShell.lnk to point to PowerShell Core
$pwsh = get-command pwsh -ErrorAction SilentlyContinue
if (-not $pwsh) {
write-error "cannot locate pwsh, exiting"
break
}
$psLinkPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk"
$WshShell = New-Object -ComObject WScript.Shell
$psLink = $WshShell.CreateShortcut($psLinkPath)
Write-Output $psLink.TargetPath
$psLink.TargetPath = $pwsh.Source
$psLink.Save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment