Internally we are trying to remove bitdefender from ~250 devices. We have got stuck as Windows still thinks bitdefender is installed. We created a script, but its coming back with an Invalid Parameter. Any help?
Our Script:
$bitdefender = Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct | Where-Object {$_.displayName -like "bitdefender"}
$instanceGuid = $bitdefender.instanceGuid
Remove-WmiObject -path \\localhost\ROOT\securitycenter2:AntivirusProduct.instanceGuid="$instanceGuid"
The first command will show the antivius's that are installed, we want to remove BitDefender not Windows Defender, so when creating the script, I tried to copy the instanceGuid from just BitDefender. Internally we tested by manually copying the instanceGuid, and pasting in the remove command, which works flawlessly, but when trying to 'automate' it, we get the following error:
.Remove-WmiObject : Invalid parameter
\bitdefender_removal.ps1
PS C:\temp> At C:\temp\bitdefender_removal.ps1:3 char:1
+ Remove-WmiObject -path \\localhost\ROOT\securitycenter2:AntivirusProd ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-WmiObject], ManagementException
+ FullyQualifiedErrorId : System.Management.ManagementException,Microsoft.PowerShell.Commands.RemoveWmiObject
Any help would be greatly appreciated
I have tried to automate this, to no avail. We can always manually do this, but for 200+ devices, its kind of a ball ache