class WinRM::WSMV::CreatePipeline
WSMV message to execute a command via psrp
Attributes
command_id[RW]
fragment[RW]
shell_id[RW]
Public Class Methods
new(session_opts, shell_id, command_id, fragment = nil)
click to toggle source
# File lib/winrm/wsmv/create_pipeline.rb, line 24 def initialize(session_opts, shell_id, command_id, fragment = nil) @command_id = command_id @session_opts = session_opts @shell_id = shell_id @fragment = fragment end
Protected Instance Methods
create_body(body)
click to toggle source
# File lib/winrm/wsmv/create_pipeline.rb, line 37 def create_body(body) body.tag!("#{NS_WIN_SHELL}:CommandLine", 'CommandId' => command_id) do |cl| cl << Gyoku.xml(command_body) end end
create_header(header)
click to toggle source
# File lib/winrm/wsmv/create_pipeline.rb, line 33 def create_header(header) header << Gyoku.xml(command_headers) end
Private Instance Methods
arguments()
click to toggle source
# File lib/winrm/wsmv/create_pipeline.rb, line 59 def arguments encode_bytes(fragment.bytes) if fragment end
command_body()
click to toggle source
# File lib/winrm/wsmv/create_pipeline.rb, line 45 def command_body { "#{NS_WIN_SHELL}:Command" => 'Invoke-Expression', "#{NS_WIN_SHELL}:Arguments" => arguments } end
command_headers()
click to toggle source
# File lib/winrm/wsmv/create_pipeline.rb, line 52 def command_headers merge_headers(shared_headers(@session_opts), resource_uri_shell(RESOURCE_URI_POWERSHELL), action_command, selector_shell_id(shell_id)) end