class WinRM::Shells::Cmd
Proxy to a remote cmd.exe shell
Public Class Methods
Source
# File lib/winrm/shells/cmd.rb, line 23 def close_shell(connection_opts, transport, shell_id) msg = WinRM::WSMV::CloseShell.new(connection_opts, shell_id: shell_id) transport.send_request(msg.build) end
Protected Instance Methods
Source
# File lib/winrm/shells/cmd.rb, line 48 def open_shell msg = WinRM::WSMV::CreateShell.new(connection_opts, shell_opts) resp_doc = transport.send_request(msg.build) REXML::XPath.first(resp_doc, "//*[@Name='ShellId']").text end
Source
# File lib/winrm/shells/cmd.rb, line 44 def response_reader @response_reader ||= WinRM::WSMV::ReceiveResponseReader.new(transport, logger) end
Source
# File lib/winrm/shells/cmd.rb, line 31 def send_command(command, arguments) cmd_msg = WinRM::WSMV::Command.new( connection_opts, shell_id: shell_id, command: command, arguments: arguments ) resp_doc = transport.send_request(cmd_msg.build) command_id = REXML::XPath.first(resp_doc, "//*[local-name() = 'CommandId']").text logger.debug("[WinRM] Command created for #{command} with id: #{command_id}") command_id end