Remove-MSCRegedit.ps1


<#PSScriptInfo
 
.VERSION 1.0
 
.GUID 95366f08-eaed-4279-bdd8-5fdd05223873
 
.AUTHOR Justin Trantham
 
.COMPANYNAME Takescake Tech
 
.COPYRIGHT 2019
 
#>


<#
 
.DESCRIPTION
 Removes Microsoft Security Client from HKCR is it exists in Registry
 
#>
 
Param()
#Setup PS Drive and Var
New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR -ErrorAction SilentlyContinue
$PathToDelete = "" 
$tmp = Get-ChildItem -Path HKCR:\Installer\Products\

#Foreach SubKey Path
foreach($RegSub in $tmp){
$Prop = get-itemproperty -path $RegSub.PSPath 
    
    #Finds if MSC is the product name
    if($Prop.ProductName -like "Microsoft Security Client")
    {
        $PathToDelete = $Prop.PSPath
    }
}

#If found remove
if($PathToDelete){
Remove-Item -Path $PathToDelete -Recurse
}