Solved

Assigning printers based on location and user after logging in through a VPN connection.

Posted on 2004-04-07
5
663 Views
Last Modified: 2012-05-04
Clients:  Windows 2000/XP
Server:  Windows 2003 AD

Here is the process:  The user boots up the PC/Laptop.  They are presented with the CTRL-ALT-DEL screen.  When the user hits CTRL-ALT-DEL they are presented with the Cisco VPN 4.0+ version client login.  Once logged into the VPN, they can then log in to the OS where login scripts can then run.

Setup after logging in:  If it is the first time a user logs in to that PC, they do not have printers installed.  We have instructed everyone on how to simply add the printers, but they normally forget and then complain about it.

Goal:  We would like to use a login script to set up the printers automatically based on the user and the location of the user.  We have users that float between sites and need sometimes 3 printers installed at each site.  I am using the following script to automatically install the printers, but this installs the exact printers no matter which site they are located at:

REM This script adds a printer without the need of Add a Printer Wizard
REM It then sets the first printer added as the default printer
rundll32 printui.dll,PrintUIEntry /in /n \\server\printer
rundll32 printui.dll,PrintUIEntry /y /n "\\server\printer"

This script would be perfect if it weren't for the floating users.  

I would normally do this at the system level through group policy, but they do not receive the group policy when booting up because they must first connect to the Cisco VPN.  This limits my ability to deploy this via a script with the exception of a user login script.  

Any help would be appreciated.  Big points!
0
Comment
Question by:stevestark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Accepted Solution

by:
ketelhuis earned 168 total points
ID: 10777145
Hi,

When you use kix, you can retrieve the ip-adsress of the users pc and, based on the ip-address, assign printers.

This off course only works when different sites have different subnets.

grtz,

Arnout
0
 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 166 total points
ID: 10801196
That script should work for you; it calculates the current subnet the user logs in from. All you have to do is add the labels and configure the printer mapping, as configured in the two example subnets. Note that the "real" subnet is calculated from the subnet mask, it's not just based on the IP octets!
Instead of the rundll32 command you're using, you can use con2prt.exe from the Zero Administration Kit as well; I like it better since, unlike the "rundll32 printui", it's a real command line tool.
If you need to map printers according to group membership, you can use the free ifmember.exe tool.

====8<----[logon.cmd]----
@echo off
setlocal
for /f "tokens=3-6 delims=:. " %%a in ('ipconfig ^| find /i "IP Address"') do (
  set IP1=%%a
  set IP2=%%b
  set IP3=%%c
  set IP4=%%d
)
set IPAddress=%IP1%.%IP2%.%IP3%.%IP4%
for /f "tokens=3-6 delims=:. " %%a in ('ipconfig ^| find /i "Subnet"') do (
  set /a SN1=%IP1% ^& %%a
  set /a SN2=%IP2% ^& %%b
  set /a SN3=%IP3% ^& %%c
  set /a SN4=%IP4% ^& %%d
)
set Subnet=%SN1%.%SN2%.%SN3%.%SN4%

echo Current IP address: %IPAddress%
echo Current Subnet:     %Subnet%
:: *** Check if the label for the subnet exists; if not, leave:
type "%~f0" | find ":[%Subnet%]" >NUL
if errorlevel 1 goto leave
goto :[%Subnet%]

:: *** Handle the different subnets:

:[192.168.1.0]
echo Mapping printers for %Subnet%:
con2prt.exe /c \\Subnet1PrintServer\Printer
goto leave

:[192.168.2.0]
echo Mapping printers for %Subnet%:
con2prt.exe /c \\Subnet2PrintServer\Printer
goto leave

:leave
====8<----[logon.cmd]----

How to Use Con2prt.exe to Connect to a Network Printer
http://support.microsoft.com/?kbid=181663

Zero Administration Kit
http://www.microsoft.com/ntworkstation/downloads/Recommended/Featured/NTZAK.asp

Resource Kits Free Tool Downloads: Ifmember.exe
http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp
0
 
LVL 3

Assisted Solution

by:haresh-nyc
haresh-nyc earned 166 total points
ID: 10818771
if the printer names are the same in each locaction,
you can take advantage of the user environment variable    LOGONSERVER.

what happens if you use the following:

rundll32 printui.dll,PrintUIEntry /in /n \\%logonserver%\printer1
rundll32 printui.dll,PrintUIEntry /y /n " \\%logonserver%\printer2

I'm assuming each user should by default become authenticated by the closest server to them,
and therefore the logonserver should be their local DC at that site.

please update us on the status.
thanks
haresh
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cloning images independently from hardware 6 93
Changing the installation path of this MSI 5 113
SCCM And Branchcache Server 1 65
Unknown Windows 7 64-bit Screen Appearance 5 68
Introduction Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like: (1) Setup files have been updated whose changes can take effect only after a reboot …
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question