default printer based on computer, not user.

S

stig

hi.

using windows2000server on the server and various clients (2000, XP) how can i
setup the computers (or the server) so that whenever a user logs in, he or she
will get the closest printer as default?

example:
computer1 is located on floor 1, printer1 on floor 1.
computer2 is located on floor 2, printer2 on floor 2.

user logs in on computer on first floor, default printer is printer1.
next the user takes the stairs up to second floor and logs in on computer2,
optimally the default printer should now be printer2.

possible?
how?

many thanks
stig
 
J

Jerold Schulman

hi.

using windows2000server on the server and various clients (2000, XP) how can i
setup the computers (or the server) so that whenever a user logs in, he or she
will get the closest printer as default?

example:
computer1 is located on floor 1, printer1 on floor 1.
computer2 is located on floor 2, printer2 on floor 2.

user logs in on computer on first floor, default printer is printer1.
next the user takes the stairs up to second floor and logs in on computer2,
optimally the default printer should now be printer2.

possible?
how?

many thanks
stig


You can do this in a logon script, if you can determine what printer goes with what computer.

The syntax for the default printer specification is See tip 672 in the 'Tips & Tricks' at http://www.jsifaq.com
Here is a Default printer specification for on of the network printers in my domain
\\jsi001.JSIINC.COM\HP Business Inkjet 2250 (PCL5C),winspool,Ne03:

Unless there is a naming convention, or OU split, I would create a text file in the netlogon share of each DC like:
computer1;specification
computer2;\specification

In my domain, here is one line:
JSI009;\\jsi001.JSIINC.COM\HP Business Inkjet 2250 (PCL5C),winspool,Ne03:

etc, so that everty computer is in the printers.txt file.

In your logon script:

set line=NONE
if not exist %LOGONSERVER%\NETLOGON\printers.txt set Device=-&goto setit
for /f "Tokens=*" %%a in ('type %LOGONSERVER%\NETLOGON\printers.txt^|findstr /b /i /l /c:"%computername%"') do (
set line=%%a
)
if "%line%" EQU "NONE" set Device=-&goto setit
set Device=%line:*;=%
set Device="%Device:\=\\%"
:setit
set reg="%TEMP%\Device_%RANDOM%.TMP"
@echo REGEDIT4>%reg%
@echo.>>%reg%
@echo [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]>>%reg%
@echo "Device"=%Device%>>%reg%
@echo.>>%reg%
@echo.>>%reg%
regedit /s %reg%
del /q %reg%
 
J

j9

My location has a logon.bat script that maps a printer to a computer based
on IP address. This, of course, is dependant on segregating subnets based
on location.

Jerold Schulman said:
You can do this in a logon script, if you can determine what printer goes with what computer.

The syntax for the default printer specification is See tip 672 in the
'Tips & Tricks' at http://www.jsifaq.com
Here is a Default printer specification for on of the network printers in my domain
\\jsi001.JSIINC.COM\HP Business Inkjet 2250 (PCL5C),winspool,Ne03:

Unless there is a naming convention, or OU split, I would create a text
file in the netlogon share of each DC like:
computer1;specification
computer2;\specification

In my domain, here is one line:
JSI009;\\jsi001.JSIINC.COM\HP Business Inkjet 2250 (PCL5C),winspool,Ne03:

etc, so that everty computer is in the printers.txt file.

In your logon script:

set line=NONE
if not exist %LOGONSERVER%\NETLOGON\printers.txt set Device=-&goto setit
for /f "Tokens=*" %%a in ('type
%LOGONSERVER%\NETLOGON\printers.txt^|findstr /b /i /l /c:"%computername%"')
do (
set line=%%a
)
if "%line%" EQU "NONE" set Device=-&goto setit
set Device=%line:*;=%
set Device="%Device:\=\\%"
:setit
set reg="%TEMP%\Device_%RANDOM%.TMP"
@echo REGEDIT4>%reg%
@echo.>>%reg%
@echo [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]>>%reg%
@echo "Device"=%Device%>>%reg%
@echo.>>%reg%
@echo.>>%reg%
regedit /s %reg%
del /q %reg%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top