Re-creating Win95 printers at logon
Walker West
wwest at kolb.com
Sun Nov 9 14:17:37 GMT 1997
I am using Samba as my logon script server. I have been trying to develop a method of creating Windows 95 printers at logon. If I modify the registry while the machines are logging in, when the script finishes and the desktop loads the printers aren't there. When the computer is rebooted the printers show up. Any idea how to get the printers to show up immediately after the registry modifications?
Here's the logon script:
@echo off
ECHO KOLBNT4 Domain Logon commencing...
echo Connecting parallel port 2 to laser...
net use lpt2 \\proxy\laser
echo.
echo Rebuilding desktop printer information...
z:\kixtart\kix32 z:\kixtart\addprint.scr
Here are the contents of addprint.scr (NOTE: kix32 is a tool included with the Windows NT resource kit):
; Remove all perisistent connections
$x=deltree("HKEY_CURRENT_USER\Network\Persistent")
$x=addkey("HKEY_CURRENT_USER\Network\Persistent")
; Remove existing printer entries in win.ini
$x=writeprofilestring("win.ini","Devices","","")
$x=writeprofilestring("win.ini","PrinterPorts","","")
$x=writeprofilestring("win.ini","windows","device","")
; Add new printer to win.ini
$x=writeprofilestring("win.ini","Devices","Panasonic KX-P4450i",
"HPPCL,\\proxy\laser")
$x=writeprofilestring("win.ini","PrinterPorts","Panasonic KX-P4450i",
"HPPCL,\\proxy\laser,15,45")
$x=writeprofilestring("win.ini","windows","device","Panasonic KX-P4450i,
HPPCL,\\proxy\laser")
; Remove existing printer entries from the registry
$x=deltree("HKEY_LOCAL_MACHINE\Config\0001
\System\CurrentControlSet\Control\Print\Printers")
$x=deltree("HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\
Print\Environments\Windows 4.0\Drivers")
$x=deltree("HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\
Print\Printers")
$x=deltree("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\
Class\Printer")
; Add printer info to registry
run "regedit /s Z:\PRINTERS\KXP4450\addprint.reg"
; Copy the printer driver to the WINDOWS directories
COPY Z:\PRINTERS\KXP4450\HPPCL.DRV %windir%\SYSTEM\HPPCL.DRV
COPY Z:\PRINTERS\KXP4450\FINSTALL.DLL %windir%\SYSTEM\FINSTALL.DLL
COPY Z:\PRINTERS\KXP4450\FINSTALL.HLP %windir%\SYSTEM\FINSTALL.HLP
COPY Z:\PRINTERS\KXP4450\ICONLIB.DLL %windir%\SYSTEM\ICONLIB.DLL
COPY Z:\PRINTERS\KXP4450\UNIDRV.DLL %windir%\SYSTEM\UNIDRV.DLL
COPY Z:\PRINTERS\KXP4450\UNIDRV.HLP %windir%\SYSTEM\UNIDRV.HLP
exit
The contents of addprint.reg are customized versions of the registry trees removed above for the Panasonic KX-P4450i.
Thanks!
--Walker West
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the samba
mailing list