ESET antivirus removal using PowerShell

# Pobieranie identyfikatora GUID dla ESET
$eset = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*ESET*" }
$esetVersion = $eset.name
$Win32_Product_query = "SELECT * FROM AntivirusProduct WHERE displayName = '$esetVersion'"
$SecurityCenter2_query = Get-WmiObject -Namespace "root\SecurityCenter2" -Query "SELECT * FROM AntivirusProduct WHERE displayName = 'ESET Endpoint Security'"
$SecurityCenter2_query2 = Get-WmiObject -Namespace "root\SecurityCenter2" -Query "SELECT * FROM AntivirusProduct WHERE displayName = 'ESET Security'"

if ($eset) {
# Wyswietlanie GUID
$eset | Select-Object Name, IdentifyingNumber

# Uzycie msiexec do odinstalowania oprogramowania
$msiGuid = $eset.IdentifyingNumber
$msiexecArgs = "/x $msiGuid /quiet /norestart"
Start-Process msiexec.exe -ArgumentList $msiexecArgs -Wait
Write-Host "ESET zostal‚ pomyslnie odinstalowany."
} 

else {
Write-Host "ESET nie zostal znaleziony w tym systemie." -BackgroundColor Green;
}

if ($SecurityCenter2_query) {
$SecurityCenter2_query | Remove-WMIObject
Write-Host "Znaleziono wpis ESET Endpoint Security w przestrzeni nazw WMI root\SecurityCenter2. Wpis został usunięty" -BackgroundColor Green;
}

if ($SecurityCenter2_query2) {
$SecurityCenter2_query2 | Remove-WMIObject
Write-Host "Znaleziono wpis ESET Security w przestrzeni nazw WMI root\SecurityCenter2. Wpis został usunięty" -BackgroundColor Green;
}