How to use Powershell to delete a WMI entry

Welcome Forums General PowerShell Q&A How to use Powershell to delete a WMI entry

  • This topic has 3 replies, 3 voices, and was last updated 9 months ago by
    js
    Participant
    .
Viewing 3 reply threads
  • Author
    Posts
    • #194597
      Participant
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      Is it possible to use Powershell to delete an object from WMI.

      Specifically one of two AntivirusProducts under root\securitycenter2
      The AntivirusProduct has a uniqe Guid

      Any examples would be appreciated

    • #194753
      js
      Participant
      Topics: 32
      Replies: 842
      Points: 2,689
      Helping Hand
      Rank: Community Hero
    • #194993
      Participant
      Topics: 7
      Replies: 122
      Points: 592
      Helping Hand
      Rank: Major Contributor

      Although I think this is a bad idea, and I did NOT test this, it should work. Just change the InstanceID

      Get-WmiObject -ClassName 'AntivirusProduct' -NameSpace 'root\securityCenter2' | Where-Object {$_.instanceGuid -Match '{XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'} | Remove-WmiObject

    • #194996
      js
      Participant
      Topics: 32
      Replies: 842
      Points: 2,689
      Helping Hand
      Rank: Community Hero

      If it’s an msi provider, uninstall package should work.

Viewing 3 reply threads
  • The topic ‘How to use Powershell to delete a WMI entry’ is closed to new replies.