OK I've been trolling through K2 to figure how they uninstall the agent from the delete agent procedure. They effectively run this command #agentPath#\KASetup.exe /r /s /g #agentInst# /l %temp%\kasetup.log now scripting is not a strong area of mine. This procedure is written on the fly by K2 when you click the button. #agentpath# is just a variable you create based on the install path of the agent, I'm having trouble figuring what #agentinst# is though it is generated by this piece of code i THINK
<scriptIf ifFunc="1" fp1="" fp2="" fp3="" ifTest="1" testVal="" scriptType="-2" description="Uninstall agent based on the agent instance GUID." /> <scriptThenElse teType="0" stepNum="1" teFunc="26" fp1="2" fp2="legacy" fp3="agentInst" osType="0" contOnFail="0" /> <scriptThenElse teType="0" stepNum="2" teFunc="26" fp1="14" fp2="" fp3="agentInst" osType="0" contOnFail="1" /> <scriptThenElse teType="0" stepNum="3" teFunc="1" fp1="306" fp2="" fp3="0" osType="0" contOnFail="0" /> </scriptDef>