VB script not workng on Win 2000
-
This script works great on the XP box I wrote it on but not on a Win 2000 box. The script was found while Googling and I have added the rename sub and a few other changes to suite my required task. I am reletivly new to dev and am not sure if the problem is win2k supporting the script or if the script needs changing. The problem is at line 70 creating the tcp ip ports. if I take this out the script runs to completion telling me the printers are added but they are not. I manually added the ports and re ran the script but no luck. Please help...
'This script will add ip ports for your local printers and attach printers to 'those ports. Just edit the arrays to reflect the paths for the .INF files 'and get the printer descriptions from the .INF files. If the printer is listed 'in the system32/inf/ntprint.inf use that as the .INF it tells the script where 'to look for the driver otherwise use the UNC path to get the path. '=================================================== strComputer = "." 'strComputer can be an array of netbios computer names or 'ip addresses put into a for loop '=================================================== Public Error Dim Count:Count=0 Set WshShell = WScript.CreateObject("WScript.Shell") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Wscript.echo "This process may take several minutes please be patient." & VbCrLf _ & "Another pop-up box will inform you when it is finished." 'Here is where your edit the port IP addresses '=================================================== Dim IPArray IPArray = Array( "192.168.100.1","192.168.100.1") Dim PrintersArray '=================================================== 'Here is where you enter the driver inf paths PrintersArray=Array("C:\CanonDrivers\win2k_xp_PCLModBW\P52KUKAL.INF",_ "C:\CanonDrivers\win2k_xp_PS_2-9\W2KPS3K.INF") '=================================================== 'Here is where you edit the printer names Dim PrinterNames PrinterNames=Array("Canon iR C5180 PCL5c", "Canon iR C5180 PS3") '=================================================== 'Here is where you edit the new printer names Dim PrinterNewNames PrinterNewNames=Array("Black and White", "Colour") '=================================================== For n = LBound(IPArray) To UBound(IPArray) 'Install the IP printer ports Install_IP_Ports IPArray(n) Next For n = LBound(IPArray) To UBound(IPArray) Count = Count + 1 'just increments the counter for the message at the end!