I am writing a script to automate the creation of printers
on a Print Server. The script points to an excel
spreadhsheet which has the printer information e.g.
Driver, IP, Model, Location etc. The script is not able to
plug in the IP for the printer. Is there a generic script
that I can use for the entire process? Or can someone help
me with the IP prolem??
CSV? Do you have a unique Printserver (HP or else)?
drivername;IP;Model;Location
abcde;10.10.111.222;HPLJ5;Loc2
drfefa;10.11.111.34;HPLJ6;Loc2
REM ===CREATE_IP_PORTS.CMD====
net stop spooler
for /f "tokens=2 delims=;" %%a in (prnlist.csv) do call :step2 %%a
net start spooler
goto :EOF
:step2
set Printer-IP-Address=%1
set Keyname=IP_%_var1:.=_%
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP Port\Ports\%Keyname%" /v HostName /d "%Printer-Hostname%"
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v HWAddress /d ""
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%", /v IPAddress /d "%Printer-IP-Address%"
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v PortNumber /t REG_DWORD0 /d 9100
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v Protocol /t REG_DWORD /d 1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v "SNMP Community" /d public
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v "SNMP Enabled" /t REG_DWORD /d 1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v "SNMP Index" /t REG_DWORD /d 1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard
TCP/IP
Port\Ports\%KeyName%" /v Version /t REG_DWORD /d 1
REM ===EOF====
The rest is
RUNDLL32 PRINTUI.DLL,PrintUIEntry ...
Please ask if unsure how to use the section above.
Ciao, Walter