ForeFront-Client-Security

Here is a script which you can use to uninstall Microsoft Forefront Client Security. In this script you will see functions for removing Microsoft Forefront Client Security Antimalware Service and Microsoft Forefront Client Security State Assessment Service.

Copy and paste this code into notepad then rename to .vbs file.

Option Explicit

const HKEY_LOCAL_MACHINE = &H80000002
Dim SASProductName, SASProductKey, SSSProductName, SSSProductKey, Msg, MsgBoxStyle, RegKey

‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub GetFCSKey()

dim oReg, sPath, aKeys, sName, sKey
Set oReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv”)

sPath = “SOFTWAREMicrosoftWindowsCurrentVersionUninstall”
oReg.EnumKey HKEY_LOCAL_MACHINE, sPath, aKeys

For Each sKey in aKeys
oReg.GetStringValue HKEY_LOCAL_MACHINE, sPath & “” & sKey, “DisplayName”, sName
If Not IsNull(sName) Then
if (sName = “Microsoft Forefront Client Security Antimalware Service”) then
SASProductKey = sKey
SASProductName = sName
end if
if (sName = “Microsoft Forefront Client Security State Assessment Service”) then
SSSProductKey = sKey
SSSProductName = sName
end if
end if
Next
end sub

‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sub UninstallFCS(key, name)
dim cmd, objShell, iReturn, oshell

cmd = “C:windowssystem32msiexec.exe /q/x ” & key
set objShell = wscript.createObject(“wscript.shell”)

objShell.LogEvent 0, “Removing the program [” & name & “] under Product Key [” & key & “]” & vbCrLf & “Executing command: ” & vbCrLf & cmd

iReturn=objShell.Run(cmd,1,TRUE)

if (iReturn = 0) then
objShell.LogEvent 0, “Program [” & name & “] was successfully removed”
else
objShell.LogEvent 0, “Failed to remove the program [” & name & “].”
end if

Set objShell = Nothing
end sub
‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SASProductKey = “”
SASProductName = “”
SSSProductKey = “”
SSSProductName = “”
call GetFCSKey()

if Not (SASProductKey = “”) then
call UninstallFCS(SASProductKey, SASProductName)
end if

if Not (SSSProductKey = “”) then
call UninstallFCS(SSSProductKey, SSSProductName)
end if
‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~