diff --git a/App Uninstall Scripts/App - Lenovo Commercial Vantage - Uninstall.ps1 b/App Uninstall Scripts/App - Lenovo Commercial Vantage - Uninstall.ps1 new file mode 100644 index 0000000..a03ff7a --- /dev/null +++ b/App Uninstall Scripts/App - Lenovo Commercial Vantage - Uninstall.ps1 @@ -0,0 +1,48 @@ +<# +Author: Leng Yang +Date: 06/24/25 + +.Synopsis +Uninstalls Lenovo Commercial Vantage and Vantage Service if detected. + +.Modified +06/24/25 (LengY) - Original script created +06/25/25 (GabeK) - Code Reviewed +#> + +# Variables # +$AppName = "Lenovo Vantage Service" +$AppxName = "LenovoSettingsforEnterprise" + +# Functions # + +Function Get-Software ($CPU = $ENV:PROCESSOR_ARCHITECTURE) { + If ($CPU -eq 'AMD64') { + $32bit = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* + $64bit = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* + $32bit + $64bit + } else { + Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* + } +} + +# Start Script # +$LVS = Get-Software | Where-Object { $_.DisplayName -like "*$AppName*" } +$LCV = Get-AppxPackage -AllUsers *$AppxName* +if (($LVS) -and ($LCV)) { + Write-Host "Lenovo Commercial Vantage detected. Beginning removal." + $LCV | Remove-AppxPackage -AllUsers + $LVSuninstall = $LVS.QuietUninstallString + Start-Sleep 1 + Start-Process -FilePath cmd -ArgumentList '/c', $LVSuninstall -NoNewWindow -Wait -PassThru | Out-Null + Start-Sleep 1 + $LVS = Get-Software | Where-Object { $_.DisplayName -like "*$AppName*" } + $LCV = Get-AppxPackage -AllUsers *$AppxName* + if (!($LVS) -and !($LCV)) { + Write-Host "Lenovo Commercial Vantage has been completely removed." + } +} else { + Write-Host "Lenovo Commercial Vantage is not installed." +} + +# End Script # \ No newline at end of file