![]() ![]() |
Apr 17 2008, 07:10 PM
Post
#1
|
|
|
Junior ![]() Group: Members Posts: 55 Joined: 16-November 04 Member No.: 36658 |
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 Function Ok, 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 |
|
|
|
Apr 18 2008, 07:39 AM
Post
#2
|
|
|
Junior ![]() Group: Members Posts: 56 Joined: 26-October 07 Member No.: 159852 OS: none
|
CODE objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 1 c:"),0, True objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 2 c:"),0, True objWShell.Run ("%comspec% /c imagex /apply ") & ColDrv & ("\Sources\WinXP.wim 3 c:"),0, True CODE objWShell.Run "%comspec% /c imagex /apply " & ColDrv & "\Sources\WinXP.wim # c:",0, True
|
|
|
|
Apr 18 2008, 08:56 AM
Post
#3
|
|
|
Junior ![]() Group: Members Posts: 55 Joined: 16-November 04 Member No.: 36658 |
Thanks I will give that a try and let you know...
Randy |
|
|
|
Apr 18 2008, 09:12 AM
Post
#4
|
|
|
Member ![]() ![]() Group: Members Posts: 244 Joined: 21-July 06 From: Helsinki Member No.: 105112
|
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 |
|
|
|
Apr 18 2008, 05:27 PM
Post
#5
|
|
|
Junior ![]() Group: Members Posts: 55 Joined: 16-November 04 Member No.: 36658 |
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, True also 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, True also 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. |
|
|
|
Apr 19 2008, 06:33 AM
Post
#6
|
|
|
Member ![]() ![]() Group: Members Posts: 244 Joined: 21-July 06 From: Helsinki Member No.: 105112
|
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 function Else MsgBox("ERROR: Files missing " & ColDrv & "\Sources\WinXP.wim" & " or " & ColDrv & "\Sources\imagex.exe") End If End Function |
|
|
|
Apr 19 2008, 09:58 PM
Post
#7
|
|
|
Junior ![]() Group: Members Posts: 55 Joined: 16-November 04 Member No.: 36658 |
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 ColDrv Dim ColDrv, SYSID Function 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 Next Using 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, True ElseIf SYSID = "30C9" Then objWShell.Run "cmd /c imagex /apply " & ColDrv & "\Sources\WinXP.wim 2 c:",0, True ElseIf SYSID = "0890" Then objWShell.Run "cmd /c imagex /apply " & ColDrv & "\Sources\WinXP.wim 3 c:",0, True End If objWShell.Run "%comspec% /c bootsect.exe /nt52 c: /force",0, True objWShell.Run "wpeutil reboot" self.close End Function Thanks for looking, Randy |
|
|
|
Apr 21 2008, 05:59 PM
Post
#8
|
|
|
Junior ![]() Group: Members Posts: 55 Joined: 16-November 04 Member No.: 36658 |
Fixed it... Duh...
Where the script is finding the CD-ROM drive I have: ColDrv = StrvDrv and it should be ColDrv = StrvDrv.Path Otherwise you get intermittent failures that can not be explained. |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 2nd December 2008 - 10:57 PM |