Created
May 14, 2020 18:13
-
-
Save devhawk/ad5f493dfda9edac2216d41d3fc43dd5 to your computer and use it in GitHub Desktop.
Update the start menu Windows PowerShell.lnk to point to PowerShell Core
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
$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