uninstall-agent operation


The uninstall-agent operation uninstalls the Operations Manager agent from the specified managed computers.

The following table describes the <items> XML and request elements for the uninstall-agent operation:

Adapter request elements for the uninstall-agent operation

The following figure illustrates a sample adapter request for the uninstall-agent operation: 

Sample adapter request for the uninstall-agent operation

<scom-request>
 <operation-name>uninstall-agent</operation-name>
 <command-request>
   <timeout-secs>120</timeout-secs>
   <command-parameters>
     <agent-managed-computer>
       <filters>
         <filter>
           <agent-prop-key>Name</agent-prop-key>
           <agent-prop-val>D-13096.synapse.com</agent-prop-val>
           <operand>equals</operand>
         </filter>
       </filters>
     </agent-managed-computer>
     <preview>true</preview>
   </command-parameters>
 </command-request>
</scom-request>


The following figure illustrates the adapter response for the sample request: 

Sample adapter response for the uninstall-agent operation

<scom-response>
 <metadata>
   <status>success</status>
   <count>1</count>
 </metadata>
 <commands-output>
   <command-output>
     <metadata>
       <command>./Microsoft.EnterpriseManagement.OperationsManager.ClientShell.
       Startup.ps1;uninstall-agent
       -agentmanagedcomputer (get-agent -managementserver ((get-
       managementserver)) | where-object {$_.Name -eq
       'D-13096.synapse.com'}) -whatif</command>
       <execution-milliseconds>5017</execution-milliseconds>
       <exit-code>0</exit-code>
       <status>success</status>
       <count>0</count>
     </metadata>
     <output>
       <line>What if: Performing operation "Uninstall-Agent" on Target "D-
       13096.synapse.com".</line>
     </output>
   </command-output>
 </commands-output>
</scom-response>

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*