diff --git a/Remove-DeltekVision.ps1 b/Remove-DeltekVision.ps1 index 2ae949e..f27e16e 100644 --- a/Remove-DeltekVision.ps1 +++ b/Remove-DeltekVision.ps1 @@ -2,24 +2,19 @@ $APP_PATH = "${Env:UserProfile}\AppData\Local\Apps\2.0" ## Test to make sure it's installed for the current user before continuing -if ( Test-Path $APP_PATH ) { - +If ( Test-Path $APP_PATH ) +{ ## Stop the process if it's currently running - try { + Try + { $Process = Get-Process -Name "DeltekVision" -ErrorAction SilentlyContinue - if ( !($Process -eq $null) ) { Stop-Process -Name $ProcessName } - } - catch { - Write-Host "Deltek Vision is running but couldn't be stopped!"; exit + If ( !($Process -eq $null) ) { Stop-Process -Name $ProcessName -Force } } + Catch { Write-Output "Deltek Vision is running but couldn't be stopped!"; Exit } ## Delete the existing installed app - try { - Remove-Item $APP_PATH -Recurse -Force - } - catch { - Write-Host "There was a problem while deleting the installed version of Deltek Vision!"; exit - } + Try { Remove-Item $APP_PATH -Recurse -Force } + Catch { Write-Output "There was a problem while deleting the installed version of Deltek Vision!"; Exit } - Write-Host "Deltek Vision was successfully uninstalled." + Write-Output "Deltek Vision was successfully uninstalled." } \ No newline at end of file diff --git a/Upgrade-DeltekVision.ps1 b/Upgrade-DeltekVision.ps1 new file mode 100644 index 0000000..07bf0b7 --- /dev/null +++ b/Upgrade-DeltekVision.ps1 @@ -0,0 +1,37 @@ +## Set the path to Deltek Vision +$APP_PATH = "${Env:UserProfile}\AppData\Local\Apps\2.0" + +## Test to make sure it's installed for the current user before continuing +If ( Test-Path $APP_PATH ) +{ + ## Stop the process if it's currently running + Try + { + $Process = Get-Process -Name "DeltekVision" -ErrorAction SilentlyContinue + If ( !($Process -eq $null) ) { Stop-Process -Name $ProcessName -Force } + } + Catch { Write-Output "Deltek Vision is running but couldn't be stopped!"; Exit } + + ## Delete the existing installed app + Try { Remove-Item $APP_PATH -Recurse -Force } + Catch { Write-Output "There was a problem while deleting the installed version of Deltek Vision!"; Exit } + + Write-Output "Deltek Vision was successfully uninstalled." +} + +## 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" } + +## Make sure IE exists where we expect it to +If ( Test-Path $IEPATH ) +{ + $WshShell = New-Object -ComObject WScript.Shell + $Shortcut = $WshShell.CreateShortcut("${Env:UserProfile}\Desktop\Deltek Vision 3.lnk") + $Shortcut.Arguments = 'https://dbia.deltekfirst.com/DBIAClient/DeltekVision.application' + $Shortcut.Description = "Launch Deltek Vision" + $Shortcut.IconLocation = "${IEPATH}, 0" + $Shortcut.WorkingDirectory = "$(Split-Path -Path $IEPATH -Parent)" + $Shortcut.TargetPath = "${IEPATH}" + $Shortcut.Save() +}