Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning printer based on IP address??

Status
Not open for further replies.

edlcsre

MIS
May 9, 2002
105
GB
Am in 'discussion' with a colleague of mine trying to find a solution to providing access to geographically close printers without the need for user intervention in the following scenario.

There are multiple sites within the organisation, and within those are departments and sub-departments. Some printers are based in a particular room, others are linked with a particular department.

Its a large Citrix farm and, currently, printers are mapped during the user logon, based on their logon script. There are a good number of terminals (thin client and desktop PC) and a number of laptop users, and therein lies the problem.

What we want to do is to have a user, with a laptop, arrive at any given office, connect to the network and receive mapping(s) to printer(s) that are geographically close to them.

The naming convention for the machines connected to the network consists of a 5 digit number, then a -, and then information about the department and/or room. All terminals start with a specific number, all laptops with another number, and so its relatively easy to check, at login, what the machine name is, and work out if its a laptop or terminal. However, what we can't work out is how to take the second part of the machine name, the department/room information and extract that to allow us to map the terminals to their local network printers, and, perhaps even more critically, what the easiest way to find out where a laptop has logged in from is, so we can then map them to the printers that are close to them.

I am guessing that we need to find some way of allocating IP addresses to machines based on their geographical location, and then using the IP address as the method for detecting where they are and which printers they require, but as for how this can be achieved I am really not sure.

I just wondered if anyone out there has anything like this in place, or could offer any pointers as to how this can be achieved with the least amount of disruption. The issue is critical enough for the idea of completely re-desiging DHCP scopes to reflect IP address ranges in geographical areas could well be considered, but, even then, I just can't picture in my mind how this would work.

The terminals are not much of a problem, as they are static and can be mapped via a logon script, its the laptop that poses the biggest problem. As there are several hundred printers, we really don't want the Citrix session to try and offer all of them as it will slow down just about everything!!

Anyone got any ideas or experience of having done something similar?

many thanks

edlcsre
 
I have written a utility to check the users IP address and enable you to run various script files, so :-

usrlogon.cmd

Start /W CheckIP 192.168.1
IF %ERRORLEVEL%==1 GOTO Map192168_printers

Start /W CheckIP 192.169.1
IF %ERRORLEVEL%==1 GOTO Map192169_printers

Start /W CheckIP 192.170.1
IF %ERRORLEVEL%==1 GOTO Map192170_printers

GOTO SkipPrinters

:192168_Printers
Call 192168Printer.Cmd

:192169_Printers
Call 192169Printer.Cmd

:192170_Printers
Call 192170Printer.Cmd

:SkipPrinters

Now, the next stage depends on how you print, but if you have printer servers for each site, you could use Con2Prt and map using that command or use Rundll32.exe if you don't.

Does this help you? If you want this program, I'll double check it works (not looked at it for ages) and see about mailing it to you! Be warned, if I get loads of requests I'll make people pay by NoCheqs or Paypal but will be a nominal amount!

Cheers,
Carl.
 
Hi Ogi

That sounds exactly what i'm looking for, my colleague was already talking about making the printer mapping itself part of a batch file, it was how to check the IP addresses that was the real issue.

If you don't mind, I'd certainly be interested in seeing the program!!

Thanks again, now we've just got to decide how to sort out the IP addresses!

Cheers

edlcsre
 
Excellent link Jeff!

edlcsre, what's your email address?

Ciao,
Carl.
 
Hi Jeff

Many thanks for the link. Unfortunately, I'd omitted to mention its a non AD environment, and has no plans to become one any time soon, so that solution is out.

Carl, my email address is edlcsre@hotmail.com

Many thanks!

 
Hi,

Consider it "in the post".


I've checked it and it works! I'll send you the file.

I'll include the test.cmd file so it shows you how it works!

Cheers,
Carl.
 
Hi Carl

Got it, but have a slight problem with the exe in my environment. have sent you an email, when you get a chance.

On the subject, however, have been giving more thought to the actual IP addresses that the clients are going to use, and trying to figure out how we could use DHCP scopes to assign specific ranges to specific areas (be that building, floor or site) Is it a case of having to have a DHCP server (and scope) for each subnet (thinking here is that if we know what the scope is, and where the scope is, we can map printers based on the IP address that the client has received via DHCP), or is there an easier way to achieve this?

I can tell I need to give this one a lot more thought. I've got a solution in mind for the terminals and desktop machines (which don't move) but can't figure out how to use laptops with DHCP to map to printers which are close to them, no matter where they log in.

edlcsre
 
Have a look at Kix scripting, you can get the IP address into a string as well as the user and Machine Name, that way you should be able to assign printers anyway you want. Get the Word Doc as well the documentation is pretty damn good.
It comes on the Resource kit for Win2K I swear by it, many a hole out has it transported me from.

Cheers
Scott
 
Hi Carl

Many thanks for your reply, you were right about me not running it in a Citrix session, will do so as soon as i am able to spend some more time working on it, you know how one top priority job gets overtaken by 2 or 3 other top priority jobs i'm sure.

Scott, many thanks for the kix suggestion, i can recall having played a little with this some time ago, and will certainly take a look and see whether this will allow me (definitely a non programmer!) to achieve what we need.

Not sure when i'll be able to work on this again but as and when i do, i'll post an update as to what we did.

thanks again

edlcsre
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top