delete antivirusproduct instance using wmi

Jacques Scheepers 1 Reputation point
2022-03-24T06:44:11.547+00:00

Good day.

I hope you are keeping well.

I'm a complete noob when it comes to powershell scripting and am still learning.

I am able to delete the instance manually using wbemtest but I'm struggling to put that into powershell.

Attached is a screenshot of wbemtest where i am able to delete the instance.

Here is where i am with powershell: Remove-WmiObject -Namespace root/securitycenter2 -class AntivirusProduct.instanceGuid="{Antivirus key}"

The above command does not work.

Please note below command can be harmfull:
Remove-WmiObject -Namespace root/securitycenter2 -class AntivirusProduct

The above command deleted the entire Antivirusproduct class. I only need to delete an instance/key in antivirusproduct.

The reason for the powershell script is that an antivirusproduct is stuck in security center and is causing the new antivirusproduct to snooze/not run because the primary antivirus is still set to the old antivirus. We need to run the command on 750 computers and I prefer not to do it manually with wbemtest.

Please let me know if you need more information or if you know where i might get an answer.

Thank you in advance186391-2022-03-24-08-32-02-testvm-on-cnd51322nw-nb-1-virt.png

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,601 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jacques Scheepers 1 Reputation point
    2022-03-24T14:08:42.267+00:00

    After clicking on the instance in wbemtest i found the path of the product

    Solution:
    Remove-WmiObject -path \localhost\ROOT\securitycenter2:AntivirusProduct.instanceGuid="{product key}"

    0 comments No comments

  2. Gonzalo MB 1 Reputation point
    2022-05-21T04:08:18.847+00:00

    Thank you for this, bet you're dealing with Webroot SecureAnywhere


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.