Skip to content

Commit

Permalink
added Remove-SymantecSC2Entries.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
danthompson-cwru committed Nov 4, 2021
1 parent d0a0899 commit 21e1f0c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Remove-SymantecSC2Entries.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<#
.SYNOPSIS
Removes entries left over in Security Center 2 after Symantec antivirus products are uninstalled.
.DESCRIPTION
Removes entries left over in Security Center 2 after Symantec antivirus products are uninstalled.
This script only works on the desktop edition of PowerShell for Microsoft Windows.
.NOTES
Author : Dan Thompson
Copyright : 2021 Case Western Reserve University
Version : 1.0.0
#>

#Requires -PSEdition Desktop
#Requires -Version 5.1
#Requires -RunAsAdministrator

[CmdletBinding(SupportsShouldProcess)]

param()

begin {
$GetWmiParams = @{
Class = 'AntiVirusProduct'
Namespace = 'root\SecurityCenter2'
Filter = 'displayName LIKE "Symantec%" OR displayName LIKE "Norton%"'
}

$RemoveWmiParams = @{
Debug = $DebugPreference
Verbose = $VerbosePreference
WhatIf = $WhatIfPreference
}
}

process {
$Entries = Get-WmiObject @GetWmiParams
$NumberOfEntries = ($Entries | Measure-Object).Count

if ($NumberOfEntries -gt 0) {
Write-Verbose -Message "Found $NumberOfEntries entries. Attempting to remove ..."
$Entries | Remove-WmiObject @RemoveWmiParams
} else {
Write-Warning -Message 'No entries found! Nothing to do.'
}
}

0 comments on commit 21e1f0c

Please sign in to comment.