# Bootstrap windows server with knife ec2 server create?

**URL:** <https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959>\
**Category:** Chef Infra (archive)\
**Created:** [May 16, 2013, 8:29am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959 "2013-05-16T08:29:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeppe\_Nejsum\_Madsen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeppe_nejsum_madsen/32/258_2.png) [@Jeppe\_Nejsum\_Madsen](https://discourse.chef.io/u/Jeppe_Nejsum_Madsen)\
**Post date:** [May 16, 2013, 8:29am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/1 "2013-05-16T08:29:45Z")

</div>

Ohai,

I’m currently using a homegrown script to launch & bootstrap an EC2 windows  
server (using a combo of knife-ec2 & knife-windows)

It seems the latest (unreleased?) knife-ec2 plugin does support windows  
images, but I can’t seem to figure out which template to use. It fails with

Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
Can not find bootstrap definition for  
ERROR: Errno::ENOENT: No such file or directory

looking in the bootstrap directory, I only see

$ ls  
/Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
archlinux-gems.erb centos5-gems.erb chef-full.erb  
fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
ubuntu12.04-gems.erb

and no windows template?

What are the incarnations needed to boot windows?

/Jeppe

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [May 16, 2013, 8:33am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/2 "2013-05-16T08:33:08Z")

</div>

Try using the 'chef-full' bootstrap template, which should use Omnibus  
for Windows. that would be '--template-file path/to/chef-full.erb' or  
'-d chef-full'

Can you also show the full stack trace from knife for that error  
and/or open a ticket for it? Use knife -VV for extra-verbose.

Cheers,

AJ

On 16 May 2013 20:29, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk) wrote:

> Ohai,
> 
> I'm currently using a homegrown script to launch & bootstrap an EC2 windows  
> server (using a combo of knife-ec2 & knife-windows)
> 
> It seems the latest (unreleased?) knife-ec2 plugin does support windows  
> images, but I can't seem to figure out which template to use. It fails with
> 
> Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
> Can not find bootstrap definition for  
> ERROR: Errno::ENOENT: No such file or directory
> 
> looking in the bootstrap directory, I only see
> 
> $ ls  
> /Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
> archlinux-gems.erb centos5-gems.erb chef-full.erb  
> fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
> ubuntu12.04-gems.erb
> 
> and no windows template?
> 
> What are the incarnations needed to boot windows?
> 
> /Jeppe

---

<div class="post-metadata">

**Author:** ![Chirag\_Jog](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/chirag_jog/32/450_2.png) [@Chirag\_Jog](https://discourse.chef.io/u/Chirag_Jog)\
**Post date:** [May 16, 2013, 8:33am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/3 "2013-05-16T08:33:43Z")

</div>

Hi Jeppe,  
The windows template is present in the knife-windows gem which also gets  
installed now. Check /User/jeppe/....../gems/knife-windows/.../  
Alternately it is available here also :  
[https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)

The README should mention this though. I file a doc bug for it.

Regards\*,\*  
_Chirag Jog_  
Chief Technology Officer,  
_Clogeny Technologies_ | [http://clogeny.com](http://clogeny.com)  
(M) 0091-9766619440 | Skype: chirag.jog

On Thu, May 16, 2013 at 1:59 PM, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk)wrote:

> Ohai,
> 
> I'm currently using a homegrown script to launch & bootstrap an EC2  
> windows server (using a combo of knife-ec2 & knife-windows)
> 
> It seems the latest (unreleased?) knife-ec2 plugin does support windows  
> images, but I can't seem to figure out which template to use. It fails with
> 
> Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
> Can not find bootstrap definition for  
> ERROR: Errno::ENOENT: No such file or directory
> 
> looking in the bootstrap directory, I only see
> 
> $ ls  
> /Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
> archlinux-gems.erb centos5-gems.erb chef-full.erb  
> fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
> ubuntu12.04-gems.erb
> 
> and no windows template?
> 
> What are the incarnations needed to boot windows?
> 
> /Jeppe

---

<div class="post-metadata">

**Author:** ![Chirag\_Jog](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/chirag_jog/32/450_2.png) [@Chirag\_Jog](https://discourse.chef.io/u/Chirag_Jog)\
**Post date:** [May 16, 2013, 8:35am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/4 "2013-05-16T08:35:00Z")

</div>

I missed mentioning this. The windows template file has to be explicitly  
supplied via the --template-file param.

Regards\*,\*  
_Chirag Jog_  
Chief Technology Officer,  
_Clogeny Technologies_ | [http://clogeny.com](http://clogeny.com)  
(M) 0091-9766619440 | Skype: chirag.jog

On Thu, May 16, 2013 at 2:03 PM, Chirag Jog [chirag@clogeny.com](mailto:chirag@clogeny.com) wrote:

> Hi Jeppe,  
> The windows template is present in the knife-windows gem which also gets  
> installed now. Check /User/jeppe/....../gems/knife-windows/.../  
> Alternately it is available here also :  
> [https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)
> 
> The README should mention this though. I file a doc bug for it.
> 
> Regards\*,\*  
> _Chirag Jog_  
> Chief Technology Officer,  
> _Clogeny Technologies_ | [http://clogeny.com](http://clogeny.com)  
> (M) 0091-9766619440 | Skype: chirag.jog
> 
> On Thu, May 16, 2013 at 1:59 PM, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk)wrote:
> 
> > Ohai,
> > 
> > I'm currently using a homegrown script to launch & bootstrap an EC2  
> > windows server (using a combo of knife-ec2 & knife-windows)
> > 
> > It seems the latest (unreleased?) knife-ec2 plugin does support windows  
> > images, but I can't seem to figure out which template to use. It fails with
> > 
> > Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
> > Can not find bootstrap definition for  
> > ERROR: Errno::ENOENT: No such file or directory
> > 
> > looking in the bootstrap directory, I only see
> > 
> > $ ls  
> > /Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
> > archlinux-gems.erb centos5-gems.erb chef-full.erb  
> > fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
> > ubuntu12.04-gems.erb
> > 
> > and no windows template?
> > 
> > What are the incarnations needed to boot windows?
> > 
> > /Jeppe

---

<div class="post-metadata">

**Author:** ![Jeppe\_Nejsum\_Madsen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeppe_nejsum_madsen/32/258_2.png) [@Jeppe\_Nejsum\_Madsen](https://discourse.chef.io/u/Jeppe_Nejsum_Madsen)\
**Post date:** [May 16, 2013, 9:14am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/5 "2013-05-16T09:14:57Z")

</div>

Thanks for the quick feedback. A few comments:

@AJ, the chef-full template (unless some magic happens somewhere 🙂 seems  
to be a bash script and is not found.

Specifying the full path to the windows-chef-client.msi.erb works, thanks.  
This is not very intuitive though!

Now the instance launches and bootstrapping is starting, but fails with an  
error

[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) CScript Error: Execution  
of the Windows Script Host failed. (0x800A0007)  
[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Failed to  
download "[https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86\_64](https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64)"  
to "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"  
[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Retrying  
download with PowerShell if available  
ERROR: Failed to authenticate to ["  
[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)"] as Administrator  
Response: Bad HTTP response returned from server (401).

I've seen this before (and mentioned elsewhere on the interwebs) and it  
seems to be an issue with WinRM not being completely ready even if the port  
is there. I've solved this in my own script by adding a delay between the  
port being available and trying to execute the bootstrap. Not exactly  
elegant....

/Jeppe

On Thu, May 16, 2013 at 10:33 AM, Chirag Jog [chirag@clogeny.com](mailto:chirag@clogeny.com) wrote:

> Hi Jeppe,  
> The windows template is present in the knife-windows gem which also gets  
> installed now. Check /User/jeppe/....../gems/knife-windows/.../  
> Alternately it is available here also :  
> [https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)
> 
> The README should mention this though. I file a doc bug for it.
> 
> Regards\*,\*  
> _Chirag Jog_  
> Chief Technology Officer,  
> _Clogeny Technologies_ | [http://clogeny.com](http://clogeny.com)  
> (M) 0091-9766619440 | Skype: chirag.jog
> 
> On Thu, May 16, 2013 at 1:59 PM, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk)wrote:
> 
> > Ohai,
> > 
> > I'm currently using a homegrown script to launch & bootstrap an EC2  
> > windows server (using a combo of knife-ec2 & knife-windows)
> > 
> > It seems the latest (unreleased?) knife-ec2 plugin does support windows  
> > images, but I can't seem to figure out which template to use. It fails with
> > 
> > Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
> > Can not find bootstrap definition for  
> > ERROR: Errno::ENOENT: No such file or directory
> > 
> > looking in the bootstrap directory, I only see
> > 
> > $ ls  
> > /Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
> > archlinux-gems.erb centos5-gems.erb chef-full.erb  
> > fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
> > ubuntu12.04-gems.erb
> > 
> > and no windows template?
> > 
> > What are the incarnations needed to boot windows?
> > 
> > /Jeppe

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [May 16, 2013, 9:37am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/6 "2013-05-16T09:37:07Z")

</div>

Wow derp, right, Windows. No idea. sorry ☹

--AJ

On 16 May 2013 21:14, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk) wrote:

> Thanks for the quick feedback. A few comments:
> 
> @AJ, the chef-full template (unless some magic happens somewhere 🙂 seems  
> to be a bash script and is not found.
> 
> Specifying the full path to the windows-chef-client.msi.erb works, thanks.  
> This is not very intuitive though!
> 
> Now the instance launches and bootstrapping is starting, but fails with an  
> error
> 
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) CScript Error: Execution  
> of the Windows Script Host failed. (0x800A0007)  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Failed to  
> download "[https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86\_64](https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64)"  
> to "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Retrying download  
> with PowerShell if available  
> ERROR: Failed to authenticate to  
> ["[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)"] as Administrator  
> Response: Bad HTTP response returned from server (401).
> 
> I've seen this before (and mentioned elsewhere on the interwebs) and it  
> seems to be an issue with WinRM not being completely ready even if the port  
> is there. I've solved this in my own script by adding a delay between the  
> port being available and trying to execute the bootstrap. Not exactly  
> elegant....
> 
> /Jeppe
> 
> On Thu, May 16, 2013 at 10:33 AM, Chirag Jog [chirag@clogeny.com](mailto:chirag@clogeny.com) wrote:
> 
> > Hi Jeppe,  
> > The windows template is present in the knife-windows gem which also gets  
> > installed now. Check /User/jeppe/....../gems/knife-windows/.../  
> > Alternately it is available here also :  
> > [https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)
> > 
> > The README should mention this though. I file a doc bug for it.
> > 
> > Regards,  
> > Chirag Jog  
> > Chief Technology Officer,  
> > Clogeny Technologies | [http://clogeny.com](http://clogeny.com)  
> > (M) 0091-9766619440 | Skype: chirag.jog
> > 
> > On Thu, May 16, 2013 at 1:59 PM, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk)  
> > wrote:
> > 
> > > Ohai,
> > > 
> > > I'm currently using a homegrown script to launch & bootstrap an EC2  
> > > windows server (using a combo of knife-ec2 & knife-windows)
> > > 
> > > It seems the latest (unreleased?) knife-ec2 plugin does support windows  
> > > images, but I can't seem to figure out which template to use. It fails with
> > > 
> > > Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
> > > Can not find bootstrap definition for  
> > > ERROR: Errno::ENOENT: No such file or directory
> > > 
> > > looking in the bootstrap directory, I only see
> > > 
> > > $ ls  
> > > /Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
> > > archlinux-gems.erb centos5-gems.erb chef-full.erb  
> > > fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
> > > ubuntu12.04-gems.erb
> > > 
> > > and no windows template?
> > > 
> > > What are the incarnations needed to boot windows?
> > > 
> > > /Jeppe

---

<div class="post-metadata">

**Author:** ![Stephen\_Nelson\_Smith](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Stephen\_Nelson\_Smith](https://discourse.chef.io/u/Stephen_Nelson_Smith)\
**Post date:** [May 16, 2013, 11:47am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/7 "2013-05-16T11:47:49Z")

</div>

You need to pass in user data to enable WinRM.

Create a local file like this called "enableWinRM.ps1"

 winrm quickconfig -q winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}' winrm set winrm/config '@{MaxTimeoutms="1800000"}' winrm set winrm/config/service '@{AllowUnencrypted="true"}' winrm set winrm/config/service/auth '@{Basic="true"}'

Then append to your knife ec2 server create command:

--user-data enableWinRM.ps1

On 16 May 2013 10:14, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk) wrote:

> Thanks for the quick feedback. A few comments:
> 
> @AJ, the chef-full template (unless some magic happens somewhere 🙂 seems  
> to be a bash script and is not found.
> 
> Specifying the full path to the windows-chef-client.msi.erb works, thanks.  
> This is not very intuitive though!
> 
> Now the instance launches and bootstrapping is starting, but fails with an  
> error
> 
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) CScript Error:  
> Execution of the Windows Script Host failed. (0x800A0007)  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Failed to  
> download "[https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86\_64](https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64)"  
> to "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Retrying  
> download with PowerShell if available  
> ERROR: Failed to authenticate to ["  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)"] as Administrator  
> Response: Bad HTTP response returned from server (401).
> 
> I've seen this before (and mentioned elsewhere on the interwebs) and it  
> seems to be an issue with WinRM not being completely ready even if the port  
> is there. I've solved this in my own script by adding a delay between the  
> port being available and trying to execute the bootstrap. Not exactly  
> elegant....
> 
> /Jeppe
> 
> On Thu, May 16, 2013 at 10:33 AM, Chirag Jog [chirag@clogeny.com](mailto:chirag@clogeny.com) wrote:
> 
> > Hi Jeppe,  
> > The windows template is present in the knife-windows gem which also gets  
> > installed now. Check /User/jeppe/....../gems/knife-windows/.../  
> > Alternately it is available here also :  
> > [https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)
> > 
> > The README should mention this though. I file a doc bug for it.
> > 
> > Regards\*,\*  
> > _Chirag Jog_  
> > Chief Technology Officer,  
> > _Clogeny Technologies_ | [http://clogeny.com](http://clogeny.com)  
> > (M) 0091-9766619440 | Skype: chirag.jog
> > 
> > On Thu, May 16, 2013 at 1:59 PM, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk)wrote:
> > 
> > > Ohai,
> > > 
> > > I'm currently using a homegrown script to launch & bootstrap an EC2  
> > > windows server (using a combo of knife-ec2 & knife-windows)
> > > 
> > > It seems the latest (unreleased?) knife-ec2 plugin does support windows  
> > > images, but I can't seem to figure out which template to use. It fails with
> > > 
> > > Bootstrapping Chef on [ec2-54-228-110-177.eu-west-1.compute.amazonaws.com](http://ec2-54-228-110-177.eu-west-1.compute.amazonaws.com)  
> > > Can not find bootstrap definition for  
> > > ERROR: Errno::ENOENT: No such file or directory
> > > 
> > > looking in the bootstrap directory, I only see
> > > 
> > > $ ls  
> > > /Users/jeppe/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife/bootstrap  
> > > archlinux-gems.erb centos5-gems.erb chef-full.erb  
> > > fedora13-gems.erb ubuntu10.04-apt.erb ubuntu10.04-gems.erb  
> > > ubuntu12.04-gems.erb
> > > 
> > > and no windows template?
> > > 
> > > What are the incarnations needed to boot windows?
> > > 
> > > /Jeppe

--  
Stephen Nelson-Smith,  
Founder, Principal Consultant,  
Atalanta Systems Ltd,  
Web: [http://agilesysadmin.net](http://agilesysadmin.net)  
Twitter: @lordcope  
Skype: atalanta.systems  
Direct: +44 (0) 1329 550203  
Mobile: +44 (0) 7917 101919

Atalanta Systems: The Agile Infrastructure Enablers  
[http://atalanta-systems.com](http://atalanta-systems.com)

---

<div class="post-metadata">

**Author:** ![Jeppe\_Nejsum\_Madsen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeppe_nejsum_madsen/32/258_2.png) [@Jeppe\_Nejsum\_Madsen](https://discourse.chef.io/u/Jeppe_Nejsum_Madsen)\
**Post date:** [May 16, 2013, 2:31pm UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/8 "2013-05-16T14:31:56Z")

</div>

Thanks

I already did this (you can see it connects and starts to run the bootstrap  
script) and it works fine with my homegrown script (but like I posted in  
the SQL server thread the memory setting seems to be ignored in winrm 3).

If I remove the waiting time for my own script it fails with the same  
error.

/Jeppe

torsdag den 16. maj 2013 skrev Stephen Nelson-Smith :

> You need to pass in user data to enable WinRM.
> 
> Create a local file like this called "enableWinRM.ps1"
> 
> winrm quickconfig -q winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}' winrm set winrm/config '@{MaxTimeoutms="1800000"}' winrm set winrm/config/service '@{AllowUnencrypted="true"}' winrm set winrm/config/service/auth '@{Basic="true"}'
> 
> Then append to your knife ec2 server create command:
> 
> --user-data enableWinRM.ps1
> 
> On 16 May 2013 10:14, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk) wrote:
> 
> Thanks for the quick feedback. A few comments:
> 
> @AJ, the chef-full template (unless some magic happens somewhere 🙂 seems  
> to be a bash script and is not found.
> 
> Specifying the full path to the windows-chef-client.msi.erb works, thanks.  
> This is not very intuitive though!
> 
> Now the instance launches and bootstrapping is starting, but fails with an  
> error
> 
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) CScript Error:  
> Execution of the Windows Script Host failed. (0x800A0007)  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Failed to  
> download "[https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86\_64](https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64)"  
> to "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Retrying  
> download with PowerShell if available  
> ERROR: Failed to authenticate to ["  
> [ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)"] as Administrator  
> Response: Bad HTTP response returned from server (401).
> 
> I've seen this before (and mentioned elsewhere on the interwebs) and it  
> seems to be an issue with WinRM not being completely ready even if the port  
> is there. I've solved this in my own script by adding a delay between the  
> port being available and trying to execute the bootstrap. Not exactly  
> elegant....
> 
> /Jeppe
> 
> On Thu, May 16, 2013 at 10:33 AM, Chirag Jog [chirag@clogeny.com](mailto:chirag@clogeny.com) wrote:
> 
> Hi Jeppe,  
> The windows template is present in the knife-windows gem which also gets  
> installed now. Check /User/jeppe/....../gems/knife-windows/.../  
> Alternately it is available here also :  
> [https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)
> 
> The README should mention this though. I file a doc bug for it.
> 
> Regards\*,\*  
> _Chirag Jog_  
> Chief Technology Officer,  
> _Clogeny Technologies_ | [http://clogeny.com](http://clogeny.com)  
> (M) 0091-9766619440 | Skype: chirag.jog
> 
> --  
> Stephen Nelson-Smith,  
> Founder, Principal Consultant,  
> Atalanta Systems Ltd,  
> Web: [http://agilesysadmin.net](http://agilesysadmin.net)  
> Twitter: @lordcope  
> Skype: atalanta.systems  
> Direct: +44 (0) 1329 550203  
> Mobile: +44 (0) 7917 101919
> 
> Atalanta Systems: The Agile Infrastructure Enablers  
> [http://atalanta-systems.com](http://atalanta-systems.com)

---

<div class="post-metadata">

**Author:** ![Paul\_Mooring](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/paul_mooring/32/475_2.png) [@Paul\_Mooring](https://discourse.chef.io/u/Paul_Mooring)\
**Post date:** [May 16, 2013, 3:13pm UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/9 "2013-05-16T15:13:55Z")

</div>

Hi Jeppe,

I think you're running into this bug: [http://tickets.opscode.com/browse/KNIFE-266](http://tickets.opscode.com/browse/KNIFE-266)

There's some more discussion in the pull request linked there, but the short answer it's a known but and your work around is more or less the way to fix it.

Paul Mooring  
Systems Engineer

> **[Chef: Enabling the Coded Enterprise through Infrastructure, Security and...](https://www.chef.io/)**
>
> Automation for all of your technology. Overcome the complexity and rapidly ship your infrastructure and apps anywhere with automation.

* * *

From: Jeppe Nejsum Madsen  
Sent: Thursday, May 16, 2013 7:31 AM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Bootstrap windows server with knife ec2 server create?

Thanks

I already did this (you can see it connects and starts to run the bootstrap script) and it works fine with my homegrown script (but like I posted in the SQL server thread the memory setting seems to be ignored in winrm 3).

If I remove the waiting time for my own script it fails with the same error.

/Jeppe

torsdag den 16. maj 2013 skrev Stephen Nelson-Smith :  
You need to pass in user data to enable WinRM.

Create a local file like this called "enableWinRM.ps1"

 winrm quickconfig -q winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}' winrm set winrm/config '@{MaxTimeoutms="1800000"}' winrm set winrm/config/service '@{AllowUnencrypted="true"}' winrm set winrm/config/service/auth '@{Basic="true"}'

Then append to your knife ec2 server create command:

--user-data enableWinRM.ps1

On 16 May 2013 10:14, Jeppe Nejsum Madsen [jeppe@ingolfs.dk](mailto:jeppe@ingolfs.dk) wrote:  
Thanks for the quick feedback. A few comments:

@AJ, the chef-full template (unless some magic happens somewhere 🙂 seems to be a bash script and is not found.

Specifying the full path to the windows-chef-client.msi.erb works, thanks. This is not very intuitive though!

Now the instance launches and bootstrapping is starting, but fails with an error

[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)[http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) CScript Error: Execution of the Windows Script Host failed. (0x800A0007)  
[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)[http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Failed to download "[https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86\_64](https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64)" to "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"  
[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)[http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com) Warning: Retrying download with PowerShell if available  
ERROR: Failed to authenticate to ["[ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)[http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com](http://ec2-54-216-82-224.eu-west-1.compute.amazonaws.com)"] as Administrator  
Response: Bad HTTP response returned from server (401).

I've seen this before (and mentioned elsewhere on the interwebs) and it seems to be an issue with WinRM not being completely ready even if the port is there. I've solved this in my own script by adding a delay between the port being available and trying to execute the bootstrap. Not exactly elegant....

/Jeppe

On Thu, May 16, 2013 at 10:33 AM, Chirag Jog [chirag@clogeny.com](mailto:chirag@clogeny.com) wrote:  
Hi Jeppe,  
The windows template is present in the knife-windows gem which also gets installed now. Check /User/jeppe/....../gems/knife-windows/.../  
Alternately it is available here also : [https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb](https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb)

The README should mention this though. I file a doc bug for it.

Regards,  
Chirag Jog  
Chief Technology Officer,  
Clogeny Technologies | [http://clogeny.com](http://clogeny.com)[http://clogeny.com/](http://clogeny.com/)  
(M) 0091-9766619440 | Skype: chirag.jog

--  
Stephen Nelson-Smith,  
Founder, Principal Consultant,  
Atalanta Systems Ltd,  
Web: [http://agilesysadmin.net](http://agilesysadmin.net)  
Twitter: @lordcope  
Skype: atalanta.systems  
Direct: +44 (0) 1329 550203  
Mobile: +44 (0) 7917 101919

Atalanta Systems: The Agile Infrastructure Enablers  
[http://atalanta-systems.com](http://atalanta-systems.com)

---

<div class="post-metadata">

**Author:** ![Jeppe\_Nejsum\_Madsen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeppe_nejsum_madsen/32/258_2.png) [@Jeppe\_Nejsum\_Madsen](https://discourse.chef.io/u/Jeppe_Nejsum_Madsen)\
**Post date:** [May 17, 2013, 6:55am UTC](https://discourse.chef.io/t/bootstrap-windows-server-with-knife-ec2-server-create/3959/10 "2013-05-17T06:55:08Z")

</div>

Paul Mooring [paul@opscode.com](mailto:paul@opscode.com) writes:

> Hi Jeppe,
> 
> I think you're running into this bug: [http://tickets.opscode.com/browse/KNIFE-266](http://tickets.opscode.com/browse/KNIFE-266)

Indeed, that seems to be the same problem.

> There's some more discussion in the pull request linked there, but the short answer it's a known but and your work around is more or less the way to fix it.

What's the schedule for new versions of the knife plugins? As you might  
gather from my latest emails, I've started working with a new setup  
involving windows 🙂 And it seems many of the knife plugins could use a  
little love when it comes to bootstrapping windows....

/Jeppe
