Created
April 7, 2016 20:15
-
-
Save jonathanmorley/c71bc861c4625eb927d06279ac8ec39e to your computer and use it in GitHub Desktop.
Powershell REPL for windows kitchen machines over WinRM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'highline/import' | |
require 'winrm' | |
endpoint = 'http://localhost:5985/wsman' | |
winrm = WinRM::WinRMWebService.new(endpoint, :negotiate, user: 'vagrant', pass: 'vagrant') | |
winrm.create_executor do |executor| | |
loop do | |
executor.run_powershell_script(ask "PS ...> ") do |stdout, stderr| | |
STDOUT.print stdout | |
STDERR.print stderr | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment