Question : printmig.exe aborting early

Not sure where to look for this.  I'm implementing a .bat file that calls a .vbs that uses printmig.exe -r to restore a cab file.

The first time through it worked fine on a freshly built pc.  Then I used cleanspl.exe to clear the drivers and run additional tests.  Since then, printmig.exe using the same command, will trigger but gets to a point where it stops the print spooler, presumably to install the cab file, and then it just drops.

Batch file call:  IF NOT EXIST C:\windows\PrintersLoaded.txt C:\windows\system32\LoadPrinters.vbs

vbs attached

What is very odd is that I can go to start, run, and type c:\windows\system32\loadprinters.vbs and it runs perfectly.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
strComputer = "."

strOS_FullName=GetOS
intProc=GetProcessor

Set WshShell=CreateObject("Wscript.Shell")


If instr(1,strOS_FullName,"XP",vbTextCompare) then
	strPrefix="xp"
ElseIf instr(1,strOS_FullName,"Vista",vbTextCompare) then
	strPrefix="vista"
ElseIf instr(1,strOS_FullName,"Windows 7",vbTextCompare) then
	strPrefix="win7"
ElseIf instr(1,strOS_FullName,"2003",vbTextCompare) then
	strPrefix="win2003"
Else
	strPrefix=""
	'msgbox strOS_FullName
End If

If strPrefix="" then
	msgbox "Could not determine OS",vbExclamation,"Cab Selector"
	wscript.quit
End If

strCab=strPrefix & "-" & intProc & ".cab"
WshShell.run "C:\Windows\system32\printmig -r " & strCab
	


Function GetOS
	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 	Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
	For Each objOS in colOSes
		GetOS=objOS.Caption
	Next
End Function

Function GetProcessor
	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
	Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
	For Each objItem in colItems
		GetProcessor=objItem.AddressWidth
	Next
End Function

Answer : printmig.exe aborting early

I solved this problem.  Printmig.exe will leave a log file of it's actions in c:\windows\system32\spool\pm\pm.log

In the log, it said that it was unable to open the cab file that I was copying into the system32 dir as a preceeding step.  For whatever reason, it couldn't open the file even though it would open find by hand.  So I pointed printmig to get the cab file from a network share, and it performs perfectly now.
Random Solutions  
 
programming4us programming4us