randalldale Posted April 18, 2008 Share Posted April 18, 2008 Hey Guys,Thanks for all you previous help. Now I need some scripting help.I have a script that needs to apply a .WIM file but seems to freeze up for a moment and then ends and I can't fiure out why... so a fresh pair of eyes?script:Function Install() Set objWShell = CreateObject("WScript.Shell") objWShell.Run(ColDrv & "\Tools\dwait.hta") If SYSID = "30C5" Then 'MsgBox "inside script" 'MsgBox ColDrv objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 1 c:"),0, True ElseIf SYSID = "30C9" Then objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 2 c:"),0, True ElseIf SYSID = "0890" Then objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 3 c:"),0, True Else msgbox "Could not find DVD attached to the system",vbError,"HP EUC" End If objWShell.Run ("%comspec% /c bootsect.exe /nt52 c: /force"), True objWShell.Run ("wpeutil reboot") self.close()End FunctionOk, I'm passing in the drive letter for the value of 'ColDrv' but the system fails to apply the WIM file yet if I type 'imagex /apply e:\sources\winXP.wim 1 c:' it works fine. anyone know why then scripting fails? Also I have tried it with 'x:\windows\system32' in front of imagex but it still fails. The MsgBox's post just fine so I know I'm in the script.Anyone have any ideas?Thanks again for your help,Randy Link to comment Share on other sites More sharing options...
WreX Posted April 18, 2008 Share Posted April 18, 2008 objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 1 c:"),0, TrueobjWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 2 c:"),0, TrueobjWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 3 c:"),0, TrueI think your problem is your Run commands and the ()'s. I think it should be:objWShell.Run "%comspec% /c imagex /apply " & ColDrv & "\Sources\WinXP.wim # c:",0, True Link to comment Share on other sites More sharing options...
randalldale Posted April 18, 2008 Author Share Posted April 18, 2008 Thanks I will give that a try and let you know...Randy Link to comment Share on other sites More sharing options...
geezery Posted April 18, 2008 Share Posted April 18, 2008 You should also try to run the same .Run without the %comspec%. For some unknown reasons it doesn't always work on WinPe v.2 environment.objWShell.Run "cmd /c imagex /apply " & ColDrv & "\Sources\WinXP.wim 2 c:",0, True Link to comment Share on other sites More sharing options...
randalldale Posted April 18, 2008 Author Share Posted April 18, 2008 Actually still failing with a error message of file not found, here is what I have...objWShell.Run "cmd /k imagex /apply " & ColDrv & "\Sources\WinXP.wim 1 c:",1, Truealso tried the following with imagex placed in the \sources folder.objWShell.Run "cmd /k " & ColDrv & "\Sources\imagex /apply " & ColDrv & "\Sources\WinXP.wim 1 c:",1, Truealso added a MsgBox ColDrv before and after the call tag and each time the correct drive is listed.Yet if I run either one on a USB ThumbDrive is works fine but a DVD install fails... any ideas cause I'm stumped???But the real kicker is that while typing this reply I tried runing the hta again without reboot and it works just fine.?.?... reboot and the image fails file not found. Link to comment Share on other sites More sharing options...
geezery Posted April 19, 2008 Share Posted April 19, 2008 Are you trying to apply the image from a network share?Try to run this before the apply function.Function CheckConnectionStatus()Set objFSO = CreateObject("Scripting.FileSystemObject")if objFso.FileExists(ColDrv & "\Sources\WinXP.wim") And objFso.FileExists(ColDrv & "\Sources\imagex.exe") Then'Do nothing, just continue and exit functionElseMsgBox("ERROR: Files missing " & ColDrv & "\Sources\WinXP.wim" & " or " & ColDrv & "\Sources\imagex.exe") End IfEnd Function Link to comment Share on other sites More sharing options...
randalldale Posted April 20, 2008 Author Share Posted April 20, 2008 Actually running it from a DVD-ROM drive.'This is the code used to find the DVD-ROM drive.'I also set a globalo variable of ColDrvDim ColDrv, SYSIDFunction Window_Onload()Set Fso = CreateObject("Scripting.FileSystemObject")Set Drv = FSO.Drives For Each StrDrv in Drv If StrDrv.DriveType = 4 or 2 Then If StrDrv.IsReady = True Then If Fso.FileExits(StrDrv & "\Tools\Tools.txt") Then ColDrv = StrvDrv End If End If Else MsgBox "Could not find DVD attached to the system", vbError End If NextUsing the Variable ColDrv I then try to run my install....I seem to make it in the script but when I go to run I get a file not found error?Do you think it is having issues with the global variable?Function Install()Set objWShell = CreateObject("WScript.Shell")objWShell.Run(ColDrv & "\Tools\dwait.hta")If SYSID = "30C5" Then 'MsgBox "inside script" 'MsgBox ColDrv objWShell.Run "cmd /c imagex /apply " & ColDrv & "\Sources\WinXP.wim 1 c:",0, TrueElseIf SYSID = "30C9" Then objWShell.Run "cmd /c imagex /apply " & ColDrv & "\Sources\WinXP.wim 2 c:",0, TrueElseIf SYSID = "0890" Then objWShell.Run "cmd /c imagex /apply " & ColDrv & "\Sources\WinXP.wim 3 c:",0, TrueEnd If objWShell.Run "%comspec% /c bootsect.exe /nt52 c: /force",0, True objWShell.Run "wpeutil reboot" self.closeEnd FunctionThanks for looking,Randy Link to comment Share on other sites More sharing options...
randalldale Posted April 21, 2008 Author Share Posted April 21, 2008 Fixed it... Duh...Where the script is finding the CD-ROM drive I have:ColDrv = StrvDrvand it should be ColDrv = StrvDrv.PathOtherwise you get intermittent failures that can not be explained. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now