This extended functionality is only supported when running on Microsoft
Windows. This gem can still be used on other operating systems just like the
WinRM gem, but the extended capabilities will not be available.
To install it, run:
gem install winrm-s
winrm-s provides the same interface as the
winrm gem -- see
- To use it, simply require
winrm-s, depending on whether your code is running on Windows. The extended negotiate protocol is only available if you include
winrm-s, which will only work on Windows.
- When you use WinRM::WinRMWebService.new, be sure to specify the
:sspinegotiateparameter, along with a user name in the form
domain_name\user_namefor the user name in order to make use of negotiate protocol. If the user account is local to the remote system, you can use
.for the domain. The example further on demonstrates the negotiate use case.
- All other use cases enabled by the
winrmgem are also supported.
Note the argument value of
:sspinegotiate for transport option, and the
explicit specification of a domain name, in this case
., in the user name:
if RUBY_PLATFORM =~ /mswin|mingw32|windows/ require 'winrm-s' # only works on Windows, otherwise use require 'winrm' endpoint = http://mywinrmhost:5985/wsman winrm = WinRM::WinRMWebService.new(endpoint, :sspinegotiate, :user => ".\administrator", :pass => "adminpasswd") winrm.cmd('ipconfig /all') do |stdout, stderr| STDOUT.print stdout STDERR.print stderr end end
Copyright:: Copyright (c) 2014 Chef Software, Inc. License:: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.