Author: arkurth Date: Mon Mar 22 13:16:05 2010 New Revision: 926063 URL: http://svn.apache.org/viewvc?rev=926063&view=rev Log: VCL-327 Changed set_computer_name.vbs to call "%comspec% /c type currentimage.txt" rather than using the VBScript commands to open and read the file. This corrects a problem if certain applications such as Aspen are installed in the image which have some sort of hook into the VBScript file open command. A box was being displayed during Sysprep minisetup asking for the application's installation files.
Modified: incubator/vcl/trunk/managementnode/tools/Windows/Scripts/set_computer_name.vbs Modified: incubator/vcl/trunk/managementnode/tools/Windows/Scripts/set_computer_name.vbs URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/tools/Windows/Scripts/set_computer_name.vbs?rev=926063&r1=926062&r2=926063&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/tools/Windows/Scripts/set_computer_name.vbs (original) +++ incubator/vcl/trunk/managementnode/tools/Windows/Scripts/set_computer_name.vbs Mon Mar 22 13:16:05 2010 @@ -105,23 +105,21 @@ end if WScript.Quit '---------------------------------------------------------- Function GetKeyValue(strFilePath, strKey, strDeliminator) - - Set objFSO = CreateObject("Scripting.FileSystemObject") - On Error Resume Next - Set objInputFile = objFSO.OpenTextFile(strCurrentImagePath) - + Set objShell = WScript.CreateObject("WScript.Shell") + strCommand = "%comspec% /c type " & strFilePath + Set objExecObject = objShell.Exec(strCommand) + if not err.number=0 then - WScript.Echo "Error opening " & strCurrentImagePath & ", " & err.Description + WScript.Echo "Error running command: " & strCommand & ", " & err.Description vbCritical err.clear GetKeyValue = "" else strPattern = "^" & strKey & strDeliminator & "(.*)$" - Do While Not (objInputFile.atEndOfStream) And Len(strValue)=0 - strLine = objInputFile.ReadLine - strValue = RegExpVal(strPattern, strLine, 0) - Loop - - objInputFile.Close + + Do While Not (objExecObject.StdOut.atEndOfStream) And Len(strValue)=0 + strLine = objExecObject.StdOut.ReadLine() + strValue = RegExpVal(strPattern, strLine, 0) + Loop GetKeyValue = strValue end if @@ -130,19 +128,17 @@ End Function '---------------------------------------------------------- Function GetImageName(strFilePath) + Set objShell = WScript.CreateObject("WScript.Shell") + strCommand = "%comspec% /c type " & strFilePath + Set objExecObject = objShell.Exec(strCommand) - Set objFSO = CreateObject("Scripting.FileSystemObject") - On Error Resume Next - Set objInputFile = objFSO.OpenTextFile(strCurrentImagePath) - if not err.number=0 then - WScript.Echo "Error opening " & strCurrentImagePath & ", " & err.Description + WScript.Echo "Error running command: " & strCommand & ", " & err.Description vbCritical err.clear GetKeyValue = "" else - strLine = objInputFile.ReadLine - objInputFile.Close - GetImageName = strLine + strLine = objExecObject.StdOut.ReadLine + GetImageName = strLine end if End Function @@ -161,4 +157,4 @@ End Function '---------------------------------------------------------- Function print_hr WScript.Echo "----------------------------------------------------------------------" -End Function \ No newline at end of file +End Function