Reg winrm auth


#1

Hi,

      Using winrm itself,how to authenticate windows from linux 

using ruby?

here is my code:
winrm = WinRM::WinRMWebService.new(“172.16.1.197”, :plaintext,
:user => “administrator”, :pass => “p@ssw0rd1”, :basic_auth_only => true)do
puts "connected successfully"
end

BUt it doesnot shows connect successfully ,it doesnot execute do loop
,also not showing any error

Thanks,
Indra


#2

Hi Indra

Your endpoint seems incorrect. Try this -

winrm = WinRM::WinRMWebService.new(“http://172.16.1.197:5985/wsman
http://2.16.1.197:5985/wsman
, :plaintext, :user => “administrator”,
:pass => “p@ssw0rd1”, :basic_auth_only => true) do
puts "connected successfully"
end

Thanks,
Mukta.

On 8 November 2014 05:25, indra indra.k@cloudenablers.com wrote:

Hi,

     Using winrm itself,how to authenticate windows from linux using

ruby?

here is my code:
winrm = WinRM::WinRMWebService.new(“172.16.1.197”, :plaintext,
:user => “administrator”, :pass => “p@ssw0rd1”, :basic_auth_only =>
true)do
puts "connected successfully"
end

BUt it doesnot shows connect successfully ,it doesnot execute do loop
,also not showing any error

Thanks,
Indra


#3

And to get the error / stdout you might need to execute a command.
Following is the complete code -

require 'winrm’
endpoint = "http://172.16.1.197:5985/wsman
http://2.16.1.197:5985/wsman"

winrm = WinRM::WinRMWebService.new(endpoint, :ssl, :user => “user”, :pass
=> “pass”, :basic_auth_only => true)
winrm.cmd(‘dir’) do |stdout, stderr|
STDOUT.print stdout
STDERR.print stderr
end

On 10 November 2014 06:40, Mukta A amukta@gmail.com wrote:

Hi Indra

Your endpoint seems incorrect. Try this -

winrm = WinRM::WinRMWebService.new(“http://172.16.1.197:5985/wsman
http://2.16.1.197:5985/wsman
, :plaintext, :user => “administrator”,
:pass => “p@ssw0rd1”, :basic_auth_only => true) do
puts "connected successfully"
end

Thanks,
Mukta.

On 8 November 2014 05:25, indra indra.k@cloudenablers.com wrote:

Hi,

     Using winrm itself,how to authenticate windows from linux using

ruby?

here is my code:
winrm = WinRM::WinRMWebService.new(“172.16.1.197”, :plaintext,
:user => “administrator”, :pass => “p@ssw0rd1”, :basic_auth_only =>
true)do
puts "connected successfully"
end

BUt it doesnot shows connect successfully ,it doesnot execute do loop
,also not showing any error

Thanks,
Indra