Windows Remote Management (WinRM) for Ruby

This is a SOAP library that uses the functionality in Windows Remote Management(WinRM) to call native object in Windows. This includes, but is not limitted to, running batch scripts, powershell scripts and fetching WMI variables. For more information on WinRM, please visit Microsoft’s WinRM site: msdn.microsoft.com/en-us/library/aa384426(v=VS.85).aspx

  • This version does not currently support encryption of messages via Kerberos so it is highly recommended to use SSL when configuring WinRM. ‘winrm quickconfig -transport:https’

My Info: BLOG: distributed-frostbite.blogspot.com/ Add me in LinkedIn: www.linkedin.com/in/danwanek Find me on irc.freenode.net in #ruby-lang (zenChild)



TO USE: require ‘winrm’ # See REQUIRED GEMS below

gem install -r winrm

REQUIRED GEMS: (These should automatically install with the winrm gem) # Handsoap gem install -r handsoap # Nokogiri XML Parser gem install -r nokogiri # HttpClient gem install -r httpclient # NTLM Library gem install -r rubyntlm #UUID Library gem install -r uuid

EXAMPLE: require ‘winrm’ WinRM::WinRM.endpoint = ‘mywinrmhost:5986/wsman’ WinRM::WinRM.set_auth(‘user’,‘password’) winrm = WinRM::WinRM.instance outputps = winrm.powershell ‘script.ps1’ outputcmd = winrm.cmd ‘ipconfig’

To specify manually where your CA certificate store is use this: WinRM::WinRM.set_ca_trust_path(‘/etc/ssl/certs’)


DISCLAIMER: If you see something that could be done better or would like to help out in the development of this code please feel free to clone the ‘git’ repository and send me patches: git clone git://github.com/zenchild/WinRM.git or add an issue on GitHub: github.com/zenchild/WinRM/issues

Cheers!