Kaseya Community

Script to remove Microsoft security essentials

This question has suggested answer(s)

Does anyone have a script to remove microsoft security essentials. I need to remove them on a large scale so i can install KES in its place.

All Replies
  • execute shell command as system:

     "%ProgramFiles%\Microsoft Security Essentials\setup.exe" /x /s

    Might also want to run it against %ProgramFiles(x86)% for 64bit systems with the 32 bit version installed.



    [edited by: Dan at 8:11 AM (GMT -8) on 11-8-2010] m
  • I already tried this command. I get a pop-up message that is trying to find msse.msi. If i remove the /s the uninstallation will go through but requires user interaction that I don't want.

  • Get the proper switches by surfing to %ProgramFiles%\Microsoft Security Essentials in a comand window then apply the /? to the setup.exe

  • I get a "command is not supported" message when running %programfiles%\microsoft security essentials\setup.exe /?

  • No, you get "Command line parameters not supported", totally different

  • This disgraceful exuse for a forum has no support for posting code....so check the formatting when importing.

    <?xml version="1.0" encoding="utf-8" ?>

    - <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

    - <Procedure name="Remove - Microsoft - Security Essentials" treePres="3">

    - <Body description="">

    - <If description="">

    - <Condition name="TestFile">

     <Parameter xsi:type="StringParameter" name="Path" value="%ProgramFiles%\Microsoft Security Essentials\setup.exe" />

     <Parameter xsi:type="EnumParameter" name="Condition" value="Exists" />

     <Parameter xsi:type="StringParameter" name="Value" value="" />

     </Condition>

    - <Then>

    - <Statement description="" name="ExecuteFile" continueOnFail="false">

     <Parameter xsi:type="StringParameter" name="Path" value="%ProgramFiles%\Microsoft Security Essentials\setup.exe" />

     <Parameter xsi:type="StringParameter" name="Arguments" value="/x /s" />

     <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

     <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True" />

     </Statement>

     </Then>

     </If>

     </Body>

     </Procedure>

     </ScriptExport>

  • FYI... the new version gets installed at "%PROGRAMFILES%\Microsoft Security Client" so you will want to add another step to your script and check "Skip if fail" on both.

  • removeMSE.txt

    This is what you want. See attachment.

  • I have successfully ran the following script on our systems.  It will uninstall version1 and 2.  This script is for K2.

    <?xml version="1.0" encoding="utf-8" ?>

    - <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

    - <Procedure name="Microsoft Security Essentials Removal" treePres="3">

    - <Body description="This is to remove Microsoft Security Essentials from the business computers as the license is for Home users only.">

    - <If description="">

    - <Condition name="TestFile">

     <Parameter xsi:type="StringParameter" name="Path" value="C:\Program Files\Microsoft Security Essentials\msseces.exe" />

     <Parameter xsi:type="EnumParameter" name="Condition" value="Exists" />

     <Parameter xsi:type="StringParameter" name="Value" value="" />

     </Condition>

    - <Then>

    - <Statement description="Set the login credentials to execute a file or shell command as this user - Windows 2000 and above only." name="ImpersonateUser" continueOnFail="false">

     <Parameter xsi:type="StringParameter" name="UserName" value="administrator" />

     <Parameter xsi:type="StringParameter" name="Password" value="Gr95!tmN" />

     <Parameter xsi:type="StringParameter" name="Domain" value="sgcmh" />

     </Statement>

    - <Statement description="Execute the specified file - full path to file required." name="ExecuteFile" continueOnFail="false" osType="Windows">

     <Parameter xsi:type="StringParameter" name="Path" value="c:\program files\Microsoft Security Essentials\setup.exe" />

     <Parameter xsi:type="StringParameter" name="Arguments" value="/x /s" />

     <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

     <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="False" />

     </Statement>

    - <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

     <Parameter xsi:type="StringParameter" name="Comment" value="Microsoft Security Essentials was uninstalled." />

     </Statement>

     </Then>

    - <Else>

    - <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="true" osType="NT4|2000|XP|2003|Vista|2008">

     <Parameter xsi:type="StringParameter" name="Comment" value="Microsoft Security Essentials is not installed." />

     </Statement>

     </Else>

     </If>

    - <If description="">

    - <Condition name="TestFile">

     <Parameter xsi:type="StringParameter" name="Path" value="C:\Program Files\Microsoft Security Client\msseces.exe" />

     <Parameter xsi:type="EnumParameter" name="Condition" value="Exists" />

     <Parameter xsi:type="StringParameter" name="Value" value="" />

     </Condition>

    - <Then>

    - <Statement description="Execute the specified file - full path to file required." name="ExecuteFile" continueOnFail="false" osType="Windows">

     <Parameter xsi:type="StringParameter" name="Path" value="C:\Program Files\Microsoft Security Client\setup.exe" />

     <Parameter xsi:type="StringParameter" name="Arguments" value="/x /s" />

     <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

     <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="False" />

     </Statement>

    - <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

     <Parameter xsi:type="StringParameter" name="Comment" value="Microsoft Security Essentials was uninstalled." />

     </Statement>

     </Then>

    - <Else>

    - <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

     <Parameter xsi:type="StringParameter" name="Comment" value="Microsoft Security Essentials is not installed." />

     </Statement>

     </Else>

     </If>

     </Body>

     </Procedure>

     </ScriptExport>

  • btgries - you just posted a password for an Administrator account in plain text.

    Also, why are you impersonating a user anyway? You should be using SYSTEM.

  • One more thing: the script I posted is for the old version of Kaseya, but I think you can still import it into K2. Just use that.

  • @joshua.niland

    This disgraceful exuse for a forum has no support for posting code....so check the formatting when importing.

    FYI

    You can encapsulate your code using the "code" and "/code" commands, make sure to use square brackets "[" & "]" before and after each command.

  • HardKnoX

    FYI

    You can encapsulate your code using the "code" and "/code" commands, make sure to use square brackets "[" & "]" before and after each command.



    I've found that this works best in using "Rich Text Formatting", much like the quote tags.

  • How do I import your script btgries? I keep getting this error:

       * The text you are trying to import is ot a valid XML or ASP import format.

       * Data at the root level is invalid. Line 3, position 1.

  • @aabbasi You will need to rewrite or reformat it, replace all the "- <" with "<". Also you can attach scripts when  you use the "Use rich formatting" option, recommend that the script gets zipped up first as Web browsers also tend to be XML viewers...