diff --git a/README.md b/README.md index 4069a40..a5f37f5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,17 @@ Or install it yourself as: ## Usage -TODO: Write usage instructions here +### PowerShell Script + + $ winrm-cli script --username joeuser --computer win-01 --password "mypassword" -- "Get-WMIObject Win32_Volume | ft Caption, DirtyBitSet -autosize" + +### CMD + + $ winrm-cli script --username joeuser --computer win-01 --password "mypassword" -- ipconfig + +### Getting a back trace + + $ winrm-cli --trace ## Contributing diff --git a/bin/winrm-cli b/bin/winrm-cli index 7ed689c..733a2bb 100755 --- a/bin/winrm-cli +++ b/bin/winrm-cli @@ -77,6 +77,10 @@ command :script do |c| c.action do |args, options| script = ARGV.join(" ").split(' -- ',2)[1] + if !script + $stderr.puts "no script supplied" + exit 1 + end # create a session session = EventMachine::WinRM::Session.new(:log_level => :info) opts = {:user => options.username, :password => options.password, :basic_auth_only => basic_auth?(options.username), :operation_timeout => 1800, :disable_sspi => true}