Solved

Install network printers if in same ip range

Posted on 2008-10-01
6
339 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 85

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 85

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
An article on effective troubleshooting
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 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