Install knife windows offline



I want to install knife windows. But my server has no internet connection .

So I want to install it offline. Can anyone tell me how can we do this.



You would approach this as you would with any other gem. Tools like artifactory and nexus can provide more sophisticated means to cache to a internal repository. However, a rudimentary approach would be to download the gem from a machine that has internet access:

gem fetch knife-windows

Then copy the downloaded .gem file to your server and install via:

gem install knife-windows-1.5.0.gem

That all said, typically knife-windows is a tool used on an administrator’s workstation and not a server node, but if that workstation has no internet connectivity, the above certainly applies.


Thank you.
I have followed what you suggested. But am getting below error.

WARNING: Unable to pull data from ‘’: Errno::ETIMEDOUT: A connection attempt failed because the co
nnected party did not properly respond after a period of time, or established connection failed because connected host h
as failed to respond. - connect(2) for “” port 443 (
1 gem installed

Here am using windows power shell . am not using Chef DK. Whenever trying to run kinfe -help , am not getting in WINRM commands in that list.

Can you help me out.


Try adding --local to the gem install command. Also have a look at


Download knife windows. Keep it in some local directory and execute following command.

gem install --force --local *.gem

Hope this will help.


Thank you . Its working for me…


I managed to install it: gem install --force --local *.gem
Successfully installed knife-windows-1.6.0
1 gem installed
but when i try to bootstrap a windows server i get this error, any idea how to resolve it?
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:310:in to_specs': Could not find 'winrm-elevated' (~> 1.0) - did find: [winrm-elevated-0.4.0] (Gem::MissingSpecVersionError) Checked in 'GEM_PATH=/root/.chefdk/gem/ruby/2.1.0:/opt/chefdk/embedded/lib/ruby/gems/2.1.0', executegem envfor more information from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1439:inblock in activate_dependencies’
from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1428:in each' from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1428:inactivate_dependencies’
from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1410:in activate' from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems.rb:220:inrescue in try_activate’
from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems.rb:213:in try_activate' from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:126:inrescue in require’
from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:40:in require' from /root/.chefdk/gem/ruby/2.1.0/gems/knife-windows-1.6.0/lib/chef/knife/windows_listener_create.rb:19:in<top (required)>'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife/core/subcommand_loader.rb:100:in load' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife/core/subcommand_loader.rb:100:inblock in load_commands’
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife/core/subcommand_loader.rb:100:in each' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife/core/subcommand_loader.rb:100:inload_commands’
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife/core/subcommand_loader.rb:110:in load_command' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife/core/subcommand_loader.rb:124:incommand_class_from’
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife.rb:153:in subcommand_class_from' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/knife.rb:214:inrun’
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/application/knife.rb:148:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/bin/knife:25:in<top (required)>'
from /opt/chefdk/bin/knife:52:in load' from /opt/chefdk/bin/knife:52:in'[details=Summary][details=Summary][details=Summary]This text will be hidden[/details][/details][/details]


It looks like the dependencies you have are not compatible with knife-windows 1.6.0 but are from an older version. You will want to ensure that the other gem files you have are updated and met the constraints of knife-windows 1.6.0.


Thanks! i just managed to install them all:
gem install --force --local *.gem
Successfully installed winrm-fs-1.0.0
Successfully installed knife-windows-1.6.0
Successfully installed rubyntlm-0.6.1
Successfully installed winrm-2.1.0
Successfully installed winrm-elevated-1.0.1
Successfully installed winrm-fs-1.0.0
6 gems installed
error is gone but i have another one:

ERROR: Network Error: Connection refused - connect(2) for
Check your knife configuration and network settings

I think its the port on the windows node, working on it.


What’s the knife command you used?


knife bootstrap -N HOSTNAME


That doesn’t leverage knife-windows but just uses the core knife bootstrap via ssh(port 22). Have a look at the knife-windows readme for example usages of knife bootstrap windows.


I used this command: knife bootstrap windows winrm IP -x ‘mydomain\username’ -N HOST
but the bootstrapping fails at this point: powershell.exe -ExecutionPolicy Unrestricted -InputFormat None -NoProfile -NonInteractive -File C:\chef\wget.ps1 “” "C:\Users\user\AppData\Local\Temp\chef-client-latest.msi" Exception calling “DownloadFile” with “2” argument(s): "Unable to connect to the remote server" At C:\chef\wget.ps1:14 char:1 + $webClient.DownloadFile($remoteUrl, $localPath); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:slight_smile: [], MethodInvocationException + FullyQualifiedErrorId : WebException Warning: Failed to download “” to "C:\Users\user\AppData\Local\Temp\chef-client-latest.msi" Warning: Retrying download with cscript … Failed download: download completed, but downloaded file not found C:\chef\wget.vbs(47, 1) msxml3.dll: The operation timed out Failed download: download completed, but downloaded file not found Exiting without bootstrapping due to download failure.
ERROR: Failed to execute command on return code 1

Any idea why? the chef-client is installed on the windows Node.


If chef is already installed on the node, you can bypass the chef client download/install by adding the --bootstrap-install-command argument and passing in a no-op commnd like exit 0.


Thank u!!! it worked!
knife bootstrap --bootstrap-install-command windows winrm IP -x ‘mydomain\username’ -N HOST