Files
management-scripts/Install-DeltekVision.ps1
T

34 lines
1.2 KiB
PowerShell
Raw Normal View History

2020-08-14 14:19:37 -04:00
## Installation location for shortcut
$InstallLocation = "${Env:Public}\Desktop\Deltek Vision.lnk"
2020-08-09 17:52:30 -04:00
## Remove the existing shortcut
2020-08-14 14:19:37 -04:00
If ( Test-Path $InstallLocation )
2020-08-09 17:52:30 -04:00
{
2020-08-14 14:19:37 -04:00
Try { Remove-Item -Path $InstallLocation -Force }
2020-08-09 17:52:30 -04:00
Catch { Write-Output $_.Exception.Message }
}
## Get the correct path to IE
If ( Test-Path "${Env:ProgramFiles(x86)}" ) { $IEPATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" }
Else { $IEPATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" }
If ( $VisionURL )
{
## Make sure IE exists where we expect it to
If ( Test-Path $IEPATH )
{
Try
{
$WshShell = New-Object -ComObject WScript.Shell
2020-08-14 14:19:37 -04:00
$Shortcut = $WshShell.CreateShortcut($InstallLocation)
2020-08-09 17:52:30 -04:00
$Shortcut.Arguments = $VisionURL
$Shortcut.Description = "Launch Deltek Vision"
$Shortcut.IconLocation = "${IEPATH}, 0"
$Shortcut.WorkingDirectory = "$(Split-Path -Path $IEPATH -Parent)"
$Shortcut.TargetPath = "${IEPATH}"
$Shortcut.Save()
}
Catch { Write-Output $_.Exception.Message }
} Else { Write-Output "Internet Explorer could not be found: ${IEPATH}" }
} Else { Write-Output "No URL to Deltek Vision was specified!" }