From ae42120f1f17a4059484ab849baae3ada73c57fe Mon Sep 17 00:00:00 2001 From: dyoder Date: Wed, 23 Dec 2020 08:16:37 -0500 Subject: [PATCH] cleanup after finished (Fix-AutodeskProductLicensing.ps1) add service installation (Install-Wireguard.ps1) --- Fix-AutodeskProductLicensing.ps1 | 12 ++++++++++++ Install-Wireguard.ps1 | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Fix-AutodeskProductLicensing.ps1 b/Fix-AutodeskProductLicensing.ps1 index 9a03a7d..a928295 100644 --- a/Fix-AutodeskProductLicensing.ps1 +++ b/Fix-AutodeskProductLicensing.ps1 @@ -16,4 +16,16 @@ If ( Test-Path $ALST ) { LogMsg "Resetting all Autodesk product licenses to named-user licenses" Try { Start-Process $ALST -ArgumentList '-r ALL:USER' -Wait } Catch { LogErr $_.Exception.Message } +} + +If ( Test-Path $LicensingSupportTool ) { + LogMsg "Deleting ""${LicensingSupportTool}""" + Try { Remove-Item $LicensingSupportTool -Force -ErrorAction SilentlyContinue } + Catch { LogErr $_.Exception.Message } +} + +If ( Test-Path $WorkingDir ) { + LogMsg "Deleting ""${WorkingDir}""" + Try { Remove-Item $WorkingDir -Recurse -Force -ErrorAction SilentlyContinue } + Catch { LogErr $_.Exception.Message } } \ No newline at end of file diff --git a/Install-Wireguard.ps1 b/Install-Wireguard.ps1 index a85b81c..705b7fd 100644 --- a/Install-Wireguard.ps1 +++ b/Install-Wireguard.ps1 @@ -8,7 +8,11 @@ If ( IsAdmin ) Else { $URL = 'https://download.wireguard.com/windows-client/wireguard-x86-latest.msi' } ## Install package - Try { Start-Process "msiexec.exe" -ArgumentList "/i ${URL} /qn /norestart DO_NOT_LAUNCH=1" -Wait } + Try { Start-Process "msiexec.exe" -ArgumentList "/i ${URL} /qn /norestart DO_NOT_LAUNCH=1" -Wait -ErrorAction Stop } + Catch { LogErr $_.Exception.Message ; Exit } + + ## Install manager service + Try { Start-Process "wireguard.exe" -ArgumentList '/installmanagerservice' -Wait -ErrorAction SilentlyContinue } Catch { LogErr $_.Exception.Message } ## Create shortcut on Public desktop