BIAINC/vagrant-windows — pull request #17 by sneal (2013-03-06 16:53:49+00:00)
Title: Fix Issue 16 - start chef-solo using runas vagrant

This fixes Issue #16 and allows the SQL Server cookbook to run without error on a Windows vagrant guest.

I added a PowerShell script that creates a System.Diagnostics.Process to ensure the PowerShell process that invokes chef-solo has the ability to delegate credentials to all the sub-processes that the SQL Server setup.exe starts. Essentially all this is doing is calling the Win32 CreateProcessAsUserW with the vagrant username and password to start a new PowerShell process.

vagrant -> winrm -> PowerShell -> ps-runas script -> PowerShell w/cred delegation -> chef-solo -> setup.exe -> setup100.exe etc

I'm not too fond of the "chef-solo -c" check to see if we need to wrap the call in the ps-runas script. I tried wrapping all PowerShell commands in this wrapper, but some fail. I suspect because of the return code or standard output not being the same when run through a sub-process.

Suggestions on how to improve this are welcome.