Files

38 lines
1.8 KiB
PowerShell
Raw Permalink Normal View History

2021-10-26 13:49:57 -04:00
$SHORTCUT_PATH = "${Env:Public}\Desktop\Deltek Vision.lnk"
2022-03-31 16:48:26 -04:00
# Remove the shortcut if it already exists
2023-10-05 13:11:38 -04:00
If ( Test-Path $SHORTCUT_PATH ) { Write-Output "Removing existing shortcut: ${SHORTCUT_PATH}" ; Remove-Item $SHORTCUT_PATH }
2022-03-31 16:48:26 -04:00
# If the shortcut doesn't exist
2021-10-26 13:49:57 -04:00
If ( -not (Test-Path $SHORTCUT_PATH) ) {
If ( $VisionURL ) {
2022-03-31 16:48:26 -04:00
2021-10-26 13:49:57 -04:00
## 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"
2022-03-31 16:48:26 -04:00
$APP_NAME = "Microsoft Edge (x64)"
2021-10-26 13:49:57 -04:00
}
ElseIf ( Test-Path "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe" ) {
$BROWSER_PATH = "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe"
2022-03-31 16:48:26 -04:00
$APP_NAME = "Microsoft Edge (x86)"
2021-10-26 13:49:57 -04:00
}
ElseIf ( Test-Path "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" ) {
$BROWSER_PATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe"
2022-03-31 16:48:26 -04:00
$APP_NAME = "Microsoft Internet Explorer (x64)"
2021-10-26 13:49:57 -04:00
}
ElseIf ( Test-Path "${Env:ProgramFiles}\Internet Explorer\iexplore.exe" ) {
$BROWSER_PATH = "${Env:ProgramFiles}\Internet Explorer\iexplore.exe"
2022-03-31 16:48:26 -04:00
$APP_NAME = "Microsoft Internet Explorer (x86)"
2021-10-26 13:49:57 -04:00
}
2022-03-31 16:48:26 -04:00
2021-10-26 13:49:57 -04:00
## Create the shortcut
If ( $BROWSER_PATH ) {
2023-10-05 13:11:38 -04:00
Write-Output "Installing Deltek Vision for ${APP_NAME}"
2023-10-06 14:16:19 -04:00
New-Shortcut -Path "${Env:Public}\Desktop\Deltek Vision.lnk" -TargetPath $BROWSER_PATH -Arguments $VisionURL -Description "Launch Deltek Vision"
2021-10-26 13:49:57 -04:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "A compatible browser could not be found: ${BROWSER_PATH}" }
2021-03-11 10:49:11 -05:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "No URL to Deltek Vision was specified!" }
}