Class: WinRM::WinRM
Instance Attribute Summary collapse
-
#winrm ⇒ Object
readonly
Returns the value of attribute winrm.
Class Method Summary collapse
-
.endpoint ⇒ Object
Fetch the current endpoint.
-
.endpoint=(endpoint, version = 2) ⇒ Object
Set the endpoint for WinRM Web Services.
-
.set_auth(user, pass) ⇒ Object
Set the SOAP username and password.
- .set_ca_trust_path(path) ⇒ Object
-
.set_http_driver(driver) ⇒ Object
Set the http driver that the SOAP back-end will use.
Instance Method Summary collapse
-
#cmd(command) ⇒ Object
Run a CMD command.
-
#initialize ⇒ WinRM
constructor
A new instance of WinRM.
-
#powershell(script_file) ⇒ Object
Run a Powershell script.
-
#wql(wql) ⇒ Object
Run a WQL Query.
Constructor Details
#initialize ⇒ WinRM
Returns a new instance of WinRM.
75 76 77 |
# File 'lib/winrm.rb', line 75 def initialize @winrm = SOAP::WinRMWebService.new end |
Instance Attribute Details
#winrm ⇒ Object (readonly)
Returns the value of attribute winrm.
39 40 41 |
# File 'lib/winrm.rb', line 39 def winrm @winrm end |
Class Method Details
.endpoint ⇒ Object
Fetch the current endpoint
52 53 54 |
# File 'lib/winrm.rb', line 52 def self.endpoint @@endpoint end |
.endpoint=(endpoint, version = 2) ⇒ Object
Set the endpoint for WinRM Web Services.
46 47 48 49 |
# File 'lib/winrm.rb', line 46 def self.endpoint=(endpoint, version = 2) @@endpoint = endpoint SOAP::WinRMWebService.endpoint(:uri => endpoint, :version => version) end |
.set_auth(user, pass) ⇒ Object
Set the SOAP username and password.
59 60 61 62 |
# File 'lib/winrm.rb', line 59 def self.set_auth(user,pass) @@user = user SOAP::WinRMWebService.set_auth(user,pass) end |
.set_ca_trust_path(path) ⇒ Object
64 65 66 |
# File 'lib/winrm.rb', line 64 def self.set_ca_trust_path(path) SOAP::WinRMWebService.set_ca_trust_path(path) end |
.set_http_driver(driver) ⇒ Object
Set the http driver that the SOAP back-end will use.
71 72 73 |
# File 'lib/winrm.rb', line 71 def self.set_http_driver(driver) Handsoap.http_driver = driver end |
Instance Method Details
#cmd(command) ⇒ Object
Run a CMD command
81 82 83 |
# File 'lib/winrm.rb', line 81 def cmd(command) @winrm.run_cmd(command) end |
#powershell(script_file) ⇒ Object
Run a Powershell script
87 88 89 |
# File 'lib/winrm.rb', line 87 def powershell(script_file) @winrm.run_powershell_script(script_file) end |
#wql(wql) ⇒ Object
Run a WQL Query
94 95 96 |
# File 'lib/winrm.rb', line 94 def wql(wql) @winrm.run_wql(wql) end |