99 lines
2.5 KiB
PowerShell
99 lines
2.5 KiB
PowerShell
# Remove Lenovo Bloatware - Silent mode with error suppression
|
|
# Run as Administrator
|
|
|
|
#Requires -RunAsAdministrator
|
|
|
|
$ErrorActionPreference = 'SilentlyContinue'
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
# Lenovo Bloatware packages to remove
|
|
$LenovoApps = @(
|
|
'Lenovo.*Settings',
|
|
'Lenovo.*Vantage',
|
|
'Lenovo.*Companion',
|
|
'Lenovo.*PowerManagement',
|
|
'Lenovo.*SystemUpdate',
|
|
'Lenovo.*UltraCharger',
|
|
'Lenovo.*Battery',
|
|
'Lenovo.*Nerve',
|
|
'Lenovo.*FusionEngine',
|
|
'Lenovo.*OneKey.*Theater',
|
|
'Lenovo.*OneKey.*Optimizer',
|
|
'LenovoLauncher',
|
|
'LenovoEasyCamera',
|
|
'PSREF',
|
|
'McAfee.*'
|
|
)
|
|
|
|
# Remove via WMI
|
|
foreach ($app in $LenovoApps) {
|
|
try {
|
|
$installed = Get-WmiObject -Class Win32_Product -Filter "Name LIKE '$app'" -ErrorAction SilentlyContinue
|
|
foreach ($item in $installed) {
|
|
$item.Uninstall() | Out-Null
|
|
}
|
|
} catch { }
|
|
}
|
|
|
|
# Remove via PowerShell App Removal
|
|
foreach ($app in $LenovoApps) {
|
|
try {
|
|
Get-AppxPackage -Name "*Lenovo*" -AllUsers -ErrorAction SilentlyContinue | Remove-AppxPackage -AllUsers
|
|
} catch { }
|
|
}
|
|
|
|
# Remove Lenovo services
|
|
$LenovoServices = @(
|
|
'LenovoCOMSvc',
|
|
'LenovoUpdate',
|
|
'LenovoWifiDisplayService',
|
|
'lolmsvc',
|
|
'LENOVO',
|
|
'LenovoEasyPlus'
|
|
)
|
|
|
|
foreach ($service in $LenovoServices) {
|
|
try {
|
|
$svc = Get-Service -Name $service -ErrorAction SilentlyContinue
|
|
if ($svc) {
|
|
Stop-Service -Name $service -Force
|
|
Set-Service -Name $service -StartupType Disabled
|
|
}
|
|
} catch { }
|
|
}
|
|
|
|
# Remove Lenovo scheduled tasks
|
|
try {
|
|
Get-ScheduledTask -TaskPath "*Lenovo*" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
|
|
} catch { }
|
|
|
|
# Remove from Registry
|
|
try {
|
|
$LenovoRegPaths = @(
|
|
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*Lenovo*',
|
|
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\*Lenovo*',
|
|
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\*Lenovo*'
|
|
)
|
|
|
|
foreach ($path in $LenovoRegPaths) {
|
|
Remove-Item -Path $path -Force -Recurse
|
|
}
|
|
} catch { }
|
|
|
|
# Remove Lenovo installation directories
|
|
$LenovoDirs = @(
|
|
'C:\Program Files\Lenovo',
|
|
'C:\Program Files (x86)\Lenovo',
|
|
'C:\ProgramData\Lenovo'
|
|
)
|
|
|
|
foreach ($dir in $LenovoDirs) {
|
|
try {
|
|
if (Test-Path $dir) {
|
|
Remove-Item -Path $dir -Recurse -Force
|
|
}
|
|
} catch { }
|
|
}
|
|
|
|
Write-Host "Lenovo bloatware removal complete." -ForegroundColor Green
|