$SHORTCUT_PATH = "${Env:Public}\Desktop\Deltek Vision.lnk" # Remove the shortcut if it already exists If ( Test-Path $SHORTCUT_PATH ) { Write-Output "Removing existing shortcut: ${SHORTCUT_PATH}" ; Remove-Item $SHORTCUT_PATH } # If the shortcut doesn't exist If ( -not (Test-Path $SHORTCUT_PATH) ) { If ( $VisionURL ) { ## Get the path to a compatible browser If ( Test-Path "${Env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe" ) { $BROWSER_PATH = "${Env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe" $APP_NAME = "Microsoft Edge (x64)" } ElseIf ( Test-Path "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe" ) { $BROWSER_PATH = "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe" $APP_NAME = "Microsoft Edge (x86)" } ElseIf ( Test-Path "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" ) { $BROWSER_PATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" $APP_NAME = "Microsoft Internet Explorer (x64)" } ElseIf ( Test-Path "${Env:ProgramFiles}\Internet Explorer\iexplore.exe" ) { $BROWSER_PATH = "${Env:ProgramFiles}\Internet Explorer\iexplore.exe" $APP_NAME = "Microsoft Internet Explorer (x86)" } ## Create the shortcut If ( $BROWSER_PATH ) { Write-Output "Installing Deltek Vision for ${APP_NAME}" New-Shortcut -Path "${Env:Public}\Desktop\Deltek Vision.lnk" -TargetPath $BROWSER_PATH -Arguments $VisionURL -Description "Launch Deltek Vision" } Else { Write-Output "A compatible browser could not be found: ${BROWSER_PATH}" } } Else { Write-Output "No URL to Deltek Vision was specified!" } }