4.7.2 Execute Command
This example shows how to execute the Del command to delete a file on the remote system with the confirmation prompt.
Command Request
-
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:Header> <wsa:To> http://localhost:80/wsman </wsa:To> <wsman:ResourceURI s:mustUnderstand="true"> http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd </wsman:ResourceURI> <wsa:ReplyTo> <wsa:Address s:mustUnderstand="true"> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:Address> </wsa:ReplyTo> <wsa:Action s:mustUnderstand="true"> http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command </wsa:Action> <wsman:MaxEnvelopeSize s:mustUnderstand="true">153600</wsman:MaxEnvelopeSize> <wsa:MessageID> uuid:F8671978-E928-49DA-ADB8-5BF97EDD9535</wsa:MessageID> <wsman:Locale xml:lang="en-US" s:mustUnderstand="false" /> <wsman:SelectorSet> <wsman:Selector Name="ShellId"> uuid:0A442A7F-4627-43AE-8751-900B509F0A1F </wsman:Selector> </wsman:SelectorSet> <wsman:OptionSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <wsman:Option Name="WINRS_CONSOLEMODE_STDIN">TRUE</wsman:Option> <wsman:Option Name="WINRS_SKIP_CMD_SHELL">FALSE</wsman:Option> </wsman:OptionSet> <wsman:OperationTimeout>PT60.000S</wsman:OperationTimeout> </s:Header> <s:Body> <rsp:CommandLine xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell"> <rsp:Command>del</rsp:Command> <rsp:Arguments>/p</rsp:Arguments> <rsp:Arguments> d:\temp\out.txt </rsp:Arguments> </rsp:CommandLine> </s:Body> </s:Envelope>
Command Response
-
<s:Envelope xml:lang="en-US" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:Header> <wsa:Action> http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandResponse </wsa:Action> <wsa:MessageID> uuid:6D79AA96-4656-4BDD-9716-FB68898DA396 </wsa:MessageID> <wsa:To> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:To> <wsa:RelatesTo>uuid:F8671978-E928-49DA-ADB8-5BF97EDD9535</wsa:RelatesTo> </s:Header> <s:Body> <rsp:CommandResponse xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell"> <rsp:CommandId>77df7bb6-b5a0-4777-abd9-9823c0774074</rsp:CommandId> </rsp:CommandResponse> </s:Body> </s:Envelope>