35 lines
1.3 KiB
PowerShell
35 lines
1.3 KiB
PowerShell
param(
|
|||
|
|
[string]$VisionURL
|
||
|
|
)
|
||
|
|
|
||
|
|
## Remove the existing shortcut
|
||
|
|
If ( Test-Path "${Env:UserProfile}\Desktop\Deltek Vision.lnk" )
|
||
|
|
{
|
||
|
|
Try { Remove-Item -Path "${Env:UserProfile}\Desktop\Deltek Vision.lnk" -Force }
|
||
|
|
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
|
||
|
|
$Shortcut = $WshShell.CreateShortcut("${Env:UserProfile}\Desktop\Deltek Vision.lnk")
|
||
|
|
$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!" }
|