Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. require 'winrm'
  2. require 'awesome_print'
  3.  
  4. endpoint = 'xxxx'
  5. username = 'yyyy'
  6. password = 'zzzz'
  7. script = 'Get-Service W32Time'
  8.  
  9. winrm = WinRM::WinRMWebService.new(
  10. endpoint,
  11. :ssl,
  12. :user => username,
  13. :pass => password,
  14. :disable_sspi => true
  15. )
  16.  
  17. winrm.set_timeout(60)
  18.  
  19. executor = winrm.create_executor
  20. results = executor.run_powershell_script(script)
  21. ap results
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement