Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'winrm'
- require 'awesome_print'
- endpoint = 'xxxx'
- username = 'yyyy'
- password = 'zzzz'
- script = 'Get-Service W32Time'
- winrm = WinRM::WinRMWebService.new(
- endpoint,
- :ssl,
- :user => username,
- :pass => password,
- :disable_sspi => true
- )
- winrm.set_timeout(60)
- executor = winrm.create_executor
- results = executor.run_powershell_script(script)
- ap results
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement