0

I'm running the following as a part of chef deployment of a windows server.

cscript /nologo C:\chef\wget.vbs /url:http://www.opscode.com/chef/install.msi /path:C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi 

The error I get is:

CScript Error: Execution of the Windows Script Host failed. (0x800A0007)

The vbs file is created by this command:

C:\Users\Administrator>(
 echo.url = WScript.Arguments.Named("url")  
 echo.path = WScript.Arguments.Named("path")  
 echo.proxy = null  
 echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")  
 echo.Set wshShell = CreateObject( "WScript.Shell" )  
 echo.Set objUserVariables = wshShell.Environment("USER")  
 echo. 
 echo.'http proxy is optional  
 echo.'attempt to read from HTTP_PROXY env var first  
 echo.On Error Resume Next  
 echo. 
 echo.If NOT (objUserVariables("HTTP_PROXY") = "") Then   
 echo.proxy = objUserVariables("HTTP_PROXY")  
 echo. 
 echo.'fall back to named arg  
 echo.ElseIf NOT (WScript.Arguments.Named("proxy") = "") Then   
 echo.proxy = WScript.Arguments.Named("proxy")  
 echo.End If  
 echo. 
 echo.If NOT isNull(proxy) Then  
 echo.'setProxy method is only available on ServerXMLHTTP 6.0+  
 echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")  
 echo.objXMLHTTP.setProxy 2, proxy  
 echo.End If  
 echo. 
 echo.On Error Goto 0  
 echo. 
 echo.objXMLHTTP.open "GET", url, false   
 echo.objXMLHTTP.send() 
 echo.If objXMLHTTP.Status = 200 Then   
 echo.Set objADOStream = CreateObject("ADODB.Stream")  
 echo.objADOStream.Open 
 echo.objADOStream.Type = 1  
 echo.objADOStream.Write objXMLHTTP.ResponseBody  
 echo.objADOStream.Position = 0  
 echo.Set objFSO = Createobject("Scripting.FileSystemObject")  
 echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path  
 echo.Set objFSO = Nothing  
 echo.objADOStream.SaveToFile path  
 echo.objADOStream.Close 
 echo.Set objADOStream = Nothing  
 echo.End if  
 echo.Set objXMLHTTP = Nothing                                                                                                                                       
) 1>C:\chef\wget.vb

If I rdp into the server and run the same first command it works successfully.

sclarson
  • 3,624
  • 21
  • 20

1 Answers1

0

I found a pull request for this had been merged into the knife-windows gem but wasn't in the released gem yet. I fixed my issue by installing the specific_install gem and using that to install from the source on github.

gem install specific_install
gem specific_install -l https://github.com/opscode/knife-windows.git
sclarson
  • 3,624
  • 21
  • 20