Jump to content

Error: invalid index, on windows 7 client


Recommended Posts

hi,i build a vb script to install a printer if not exist, but on some windows 7 (not all windows 7 client) i have this error:Error: Invalid IndexCode: 8002000BOrigin: SWbemObjectExthis is the part of code with "error" for windows 7

........sub GroupPrinterpadova1 ()Set Printers = WshNetwork.EnumPrinterConnectionsFor i = 0 to Printers.Count - 1 Step 2   if Printers.Item(i+1)="\\srv-dc-01\PDPRINTER01 (RICOH Aficio MP 161 PCL6)" then	PrinterPD1=1		end ifnextif PrinterPD1<>1 thenWshNetwork.AddWindowsPrinterConnection "\\" & printpadova & "\PDPRINTER01"end ifend sub..............

i put some echo to see where exactly the error start and:1)if i change this line adding ():

Set Printers = WshNetwork.EnumPrinterConnectionsintoSet Printers = WshNetwork.EnumPrinterConnections()

the script go on , to second if statementand2)if i insert an else:

if PrinterPD1<>1 thenWshNetwork.AddWindowsPrinterConnection "\\" & printpadova & "\PDPRINTER01"end ifintoif PrinterPD1<>1 thenWshNetwork.AddWindowsPrinterConnection "\\" & printpadova & "\PDPRINTER01"elseend if

the script go on and done all but when arrive at end sub,i have the error.then i try to delete a part of codeA)if i delete cycle for--next, all go well(the content of cycle for not matter at all)B)if i delete the second if --- enf if, all go wellsomeone could explain me?this error popup only on some windows 7 clientthxlorenzo

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...