-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0a0899
commit 21e1f0c
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' | ||
} | ||
} |