Kaseya Community

Power-shell script in R9.2

  • I made the following XML procedure with a Execute Power-shell command:

    <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
    ");"><Procedure name="KAV Uninstall PW Check (64-bit)" treePres="3" id="182480474" folderId="316788165325666" treeFullPath="myProcedures - username.KAV Uninstall Password Check">
    ");"><Body description="">
    ");"><Statement name="Execute Powershell" continueOnFail="false">
    <Parameter xsi:type="StringParameter" name="Parameter1" value=""/>
    <Parameter xsi:type="StringParameter" name="Parameter2" value="Get-ItemProperty -Path HKLM:\SOFTWARE\Wow6432Node\KasperskyLab\protected\KES10*\settings | Select OPEP | Format-Table -HideTableHeaders"/>
    <Parameter xsi:type="StringParameter" name="Parameter3" value="True"/>
    </Statement>
    ");"><Statement name="SendEmail" continueOnFail="false">
    <Parameter xsi:type="StringParameter" name="To" value="#adminDefaults.adminEmail#"/>
    <Parameter xsi:type="StringParameter" name="Subject" value="KAV Uninstall PW - #vAgentConfiguration.machName#"/>
    <Parameter xsi:type="MultiLineStringParameter" name="Body" value="Kaspersky Antivirus Uninstall Password for #vAgentConfiguration.Machine_GroupID#: #global:psresult#"/>
    </Statement>
    </Body>
    </Procedure>
    </ScriptExport>
    Tested it successfully in my test environment with Kaseya R9.3 but keeps failing when I run the procedure in Kaseya R9.2 (Failed THEN in step 1 (Line 1).
     
    Any suggestions? or isn't it possible to run Power-shell commands in R9.2?
  • Powershell works just fine in 9.2

    You can pull the KAV Uninstall password from the UI by going to Anti-Virus -> Show -> Machines -> Installation column set -> Side window -> Uninstall password.

    But!  Try this:

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

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

    -<Procedure treeFullPath="myProcedures - username" folderId="23762123884155233481182249" id="704545894" treePres="3" name="KAV Uninstall PW Check (64-bit)">

    -<Body description="">

    -<Statement name="Execute Powershell" continueOnFail="false">

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

    <Parameter name="Parameter2" value="Get-ItemProperty -Path HKLM:\SOFTWARE\Wow6432Node\KasperskyLab\protected\KES10*\settings | Select OPEP | Format-Table -HideTableHeaders" xsi:type="StringParameter"/>

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

    </Statement>

    -<Statement name="SendEmail" continueOnFail="false">

    <Parameter name="To" value="#adminDefaults.adminEmail#" xsi:type="StringParameter"/>

    <Parameter name="Subject" value="KAV Uninstall PW - #vAgentConfiguration.machName#" xsi:type="StringParameter"/>

    <Parameter name="Body" value="Kaspersky Antivirus Uninstall Password for #vAgentConfiguration.Machine_GroupID#: #global:psresult#" xsi:type="MultiLineStringParameter"/>

    </Statement>

    </Body>

    </Procedure>

    </ScriptExport>

  • Thanks for your reply @mcconnell

    Unfortunately your procedure is not working it VSA R9.2, however it does work in VSA R9.3.

    I am aware of the Installation Column Set in the Anti-Virus module but I wanted to verify the registry value from some of the agents. We are currently experiencing some problems with KAV licenses not getting updated. I read that it might have to do with the OPEP key. (helpdesk.kaseya.com/.../98155367-KAV-License-is-Expired-Due-To-Missing-Uninstall-Password-in-Registry)