Class: WinRM::PSRP::MessageFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/winrm/psrp/message_factory.rb

Overview

Creates WinRM::PSRP::Message instances for various PSRP messages

Class Method Summary collapse

Class Method Details

.create_pipeline_message(runspace_pool_id, pipeline_id, command) ⇒ Object

Creates a new PSRP message that creates pipline to execute a command. response.

Parameters:

  • runspace_pool_id (String)

    The UUID of the remote shell/runspace pool.

  • pipeline_id (String)

    The UUID to correlate the command/pipeline

  • command (String)

    The command passed to Invoke-Expression.



48
49
50
51
52
53
54
55
# File 'lib/winrm/psrp/message_factory.rb', line 48

def create_pipeline_message(runspace_pool_id, pipeline_id, command)
  Message.new(
    runspace_pool_id,
    Message::MESSAGE_TYPES[:create_pipeline],
    render('create_pipeline', command: command.encode(xml: :text)),
    pipeline_id
  )
end

.init_runspace_pool_message(runspace_pool_id) ⇒ Object

Creates a new init runspace pool PSRP message.

Parameters:

  • runspace_pool_id (String)

    The UUID of the remote shell/runspace pool.



35
36
37
38
39
40
41
# File 'lib/winrm/psrp/message_factory.rb', line 35

def init_runspace_pool_message(runspace_pool_id)
  Message.new(
    runspace_pool_id,
    Message::MESSAGE_TYPES[:init_runspacepool],
    render('init_runspace_pool')
  )
end

.session_capability_message(runspace_pool_id) ⇒ Object

Creates a new session capability PSRP message.

Parameters:

  • runspace_pool_id (String)

    The UUID of the remote shell/runspace pool.



25
26
27
28
29
30
31
# File 'lib/winrm/psrp/message_factory.rb', line 25

def session_capability_message(runspace_pool_id)
  Message.new(
    runspace_pool_id,
    Message::MESSAGE_TYPES[:session_capability],
    render('session_capability')
  )
end