Solved

Install network printers if in same ip range

Posted on 2008-10-01
6
338 Views
Last Modified: 2013-12-23
Hello,

we currently use a diferent batch files that installs about 20 printers on a users machine,depending on which floor they are on. we have to run this manually for each user. i would like to create a script / batch file to check what the ip address of the client is if matches criteria to call a certain batch file for the floor that the user is logged onto.

i hope this makes sense.
0
Comment
Question by:rgoddard2008
[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
6 Comments
 

Expert Comment

by:gblund
ID: 22614096
Perhaps this could be in your interest. KixtArt is a tool which can help you set up scripts - here is the link for kixart http://www.kixtart.org/

With this tool i am sure you can make a script that checks for ip address and then connects them to the right printers. If you google for kixtart scripts you can easilly find examples on how to do this - if you connects printer based on groupmemberships instead.

Good luck
0
 
LVL 84

Expert Comment

by:oBdA
ID: 22614910
What are those "certain criterias"? Do you have different subnets per floor, or are they all in the same subnet, but different ranges?
0
 

Author Comment

by:rgoddard2008
ID: 22615120
same subnet different gateway and range of ip

example 192.168.1 = floor one
               192.168.2 = floor two
0
 
LVL 33

Accepted Solution

by:
MikeKane earned 250 total points
ID: 22615168
There was a question very similar to this that I Robsampson and I worked on :
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23749378.html?sfQueryTermInfo=1+case+select+strcsubnet

Use the same script and replace the Map Network Drive with a map printer statement instead and it would work for you as well.
0
 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 250 total points
ID: 22615457
If you're using the standard network masks for a 192.168 private subnet (255.255.255.0), then your examples are on different subnets.
The script below will calculate the client's correct subnet based on the subnet mask, and you can then use the subnet to call the different batch scripts:
@echo off
setlocal
 
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "IP Address"') do set IP=%%a
set IP=%IP: =%
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "Subnet"') do set Mask=%%a
set Mask=%Mask: =%
for /f "tokens=1-4 delims=." %%a in ("%IP%") do (
  set s1=%%a
  set s2=%%b
  set s3=%%c
  set s4=%%d
)
for /f "tokens=1-4 delims=." %%a in ("%Mask%") do (
  set /a s1 "&=" %%a
  set /a s2 "&=" %%b
  set /a s3 "&=" %%c
  set /a s4 "&=" %%d
)
set LocalNet=%s1%.%s2%.%s3%.%s4%
echo Local Subnet: %LocalNet%
if "%LocalNet%"=="192.168.1.0" call Floor1.bat
if "%LocalNet%"=="192.168.2.0" call Floor2.bat

Open in new window

0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

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

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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