chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

--winrm-shell is not working #398

Closed ManishMehra closed 8 years ago

ManishMehra commented 8 years ago

Hi

Correct me if I am wrong.

I am trying to use --winrm-shell in following command

knife winrm --winrm-shell elevated NODENAME "chef-client -c c:/chef/client.rb" -m -x user-name -P "Super-secret-password"

And I am getting following error:

Error: invalid option: --winrm-shell

I reinstalled knife windows from gem sites. Didn't help.

Please guide

mwrock commented 8 years ago

In order for the --winrm-shell argument to be available, knife-windows 1.6.0 must be used. If you have installed knife-windows 1.6.0 but are receiving the above error, its likely you have multiple rubies on your machine and the one that the knife command calls into is different from the one where knife-windows 1.6.0 is installed.

If you are using chef-dk, using chef gem install knife-windows can help ensure that the gem is installed correctly. Note that there can be issues with knife-windows 1.6.0 in chef-dk 0.17.17. My recomendation is to install the new chef-dk (what we will likely be releasing tomorrow). See https://discourse.chef.io/t/pre-release-announcement-chef-dk-0-18-22/9461 for install details.

ManishMehra commented 8 years ago

Thanks @mwrock I read your reply on https://discourse.chef.io/t/how-to-use-knife-winrm-with-elevated-privileges/9467 as well. I will wait for new chefDK release.

flag = null timeout: tonight if chef-dk.version >= 0.18.22 install chef-dk flag = installed end end if flag == null install knife-windows 1.6.0 end

Cheers Manish Mehra

ManishMehra commented 8 years ago

Hi @mwrock

Thanks for giving heads for new release. --winrm-shell is live and congratulations for that.

I am getting this error though:

The argument 'c:/windows/temp/winrm-elevated-shell-50fa1bdb-3e83-4230-9fdb-c3e2d67117e5.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the –File parameter. Cannot find path 'C:\windows\temp\winrm-elevated-shell-50fa1bdb-3e83-4230-9fdb-c3e2d67117e5.ps1' because it does not exist.

At line:103 char:4

Cheers! -MM

mwrock commented 8 years ago

That error indicates that the script file thats missing was not succesfully uploaded to the node.

Could you run the knife command with -VV and include a link to a gist with the output that may reveal an error higher up the chain? or hopefully some clue as to what went wrong in that upload? Thanks!

ManishMehra commented 8 years ago

Hi @mwrock Everything is working fine now. There must have been some network glitch which failed the upload.

Thanks