only create shortcut if it doesn't exist
This commit is contained in:
+30
-26
@@ -1,28 +1,32 @@
|
|||||||
If ( $VisionURL ) {
|
$SHORTCUT_PATH = "${Env:Public}\Desktop\Deltek Vision.lnk"
|
||||||
|
If ( -not (Test-Path $SHORTCUT_PATH) ) {
|
||||||
## Get the path to a compatible browser
|
If ( $VisionURL ) {
|
||||||
If ( Test-Path "${Env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe" ) {
|
|
||||||
$BROWSER_PATH = "${Env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe"
|
## Get the path to a compatible browser
|
||||||
$APP_NAME = "Edge (x64)"
|
If ( Test-Path "${Env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe" ) {
|
||||||
|
$BROWSER_PATH = "${Env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe"
|
||||||
|
$APP_NAME = "Edge (x64)"
|
||||||
|
}
|
||||||
|
ElseIf ( Test-Path "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe" ) {
|
||||||
|
$BROWSER_PATH = "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe"
|
||||||
|
$APP_NAME = "Edge (x86)"
|
||||||
|
}
|
||||||
|
ElseIf ( Test-Path "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" ) {
|
||||||
|
$BROWSER_PATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe"
|
||||||
|
$APP_NAME = "Internet Explorer (x64)"
|
||||||
|
}
|
||||||
|
ElseIf ( Test-Path "${Env:ProgramFiles}\Internet Explorer\iexplore.exe" ) {
|
||||||
|
$BROWSER_PATH = "${Env:ProgramFiles}\Internet Explorer\iexplore.exe"
|
||||||
|
$APP_NAME = "Internet Explorer (x86)"
|
||||||
|
}
|
||||||
|
|
||||||
|
## Create the shortcut
|
||||||
|
If ( $BROWSER_PATH ) {
|
||||||
|
|
||||||
|
LogMsg "Installing Deltek Vision using ${APP_NAME}"
|
||||||
|
Create-Shortcut -Path "${Env:Public}\Desktop\Deltek Vision.lnk" -TargetPath $BROWSER_PATH -Arguments $VisionURL -Description "Launch Deltek Vision"
|
||||||
|
}
|
||||||
|
Else { LogMsg "A compatible browser could not be found: ${BROWSER_PATH}" }
|
||||||
}
|
}
|
||||||
ElseIf ( Test-Path "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe" ) {
|
Else { LogMsg "No URL to Deltek Vision was specified!" }
|
||||||
$BROWSER_PATH = "${Env:ProgramFiles}\Microsoft\Edge\Application\msedge.exe"
|
|
||||||
$APP_NAME = "Edge (x86)"
|
|
||||||
}
|
|
||||||
ElseIf ( Test-Path "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" ) {
|
|
||||||
$BROWSER_PATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe"
|
|
||||||
$APP_NAME = "Internet Explorer (x64)"
|
|
||||||
}
|
|
||||||
ElseIf ( Test-Path "${Env:ProgramFiles}\Internet Explorer\iexplore.exe" ) {
|
|
||||||
$BROWSER_PATH = "${Env:ProgramFiles}\Internet Explorer\iexplore.exe"
|
|
||||||
$APP_NAME = "Internet Explorer (x86)"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Create the shortcut
|
|
||||||
If ( $BROWSER_PATH ) {
|
|
||||||
LogMsg "Installing Deltek Vision using ${APP_NAME}"
|
|
||||||
Create-Shortcut -Path "${Env:Public}\Desktop\Deltek Vision.lnk" -TargetPath $BROWSER_PATH -Arguments $VisionURL -Description "Launch Deltek Vision"
|
|
||||||
}
|
|
||||||
Else { LogMsg "A compatible browser could not be found: ${BROWSER_PATH}" }
|
|
||||||
}
|
}
|
||||||
Else { LogMsg "No URL to Deltek Vision was specified!" }
|
|
||||||
|
|||||||
Reference in New Issue
Block a user