Script that can add Printers to all the workstations in all the floors

Not applicable

Hi,

I am looking for a script that can add Printers to all the workstations in
all the floors.
We have around 40 floor building and each floor has 5 to 6 printers
installed. We have created a script for each floor including
all the printer IP & name, we have tested pushing this script to each floor. So we have around 40 scripts belonging to each floor.

I need a script that includes all the 40 scripts, so that it can install the
printers to all the floors & subnets it belongs to.

Thanks In Advance.

Regards
Kumaresh Kulal

20 REPLIES 20

stevewood
Honored Contributor II
Honored Contributor II

Either it's 40 policies in the JSS, or it's 40 or 41 scripts in Casper
On Fri, Sep 3, 2010 at 1:46 PM, Kumaresh.kulal <kumaresh.kulal at gmail.com>wrote:
Admin. Either way, it's a lot of information.

Here's how I would handle it:

1) Create the master script that calls the other 40 scripts. Using the
same script I posted earlier, using case statements to call the proper floor
script based on network information.

2) Add the 40 floor scripts to Casper Admin, along with the master script
created above.

3) Create a policy to run at login that triggers the master script.

That's how I would handle it, simply because I do not like having 40
policies in the JSS, it's just too crowded (Oh, I smell a feature request). And, either way, if there is a change to a floor, you'll have to update the
floor script.

Just my two buffalo nickels.

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

talkingmoose
Moderator
Moderator

How are you deploying your individual scripts? If you use a policy then
On 9/3/10 10:52 AM, "Kumaresh.kulal" <kumaresh.kulal at gmail.com> wrote:
you can include all 40 scripts in one policy to apply to all machines. No
need to combine them into one script.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

Not applicable

Or write one big script using a case statement to validate the
conditions maybe?
- JD

stevewood
Honored Contributor II
Honored Contributor II

How do you identify which floor a computer is on? Is this done by the
naming convention of the computer, or are they separated out in the JSS?

If the floor is identified in the name of the computer, then you could parse
the name in a shell script and then use a case statement to push the correct
printer settings.

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

Not applicable

Yes we can use Casper policy but there is only limited option to select in
scope where i can only select the building or individual computer,
department, there is no option to select the Subnets of the each Floor.

How to include the subnets, where the policy can initiated using Subnets of
each floor where Mac workstations are present in those subnets.

Thanks & Regards
Kumaresh

dderusha
Contributor
On Sep 3, 2010, at 11:29 AM, Kumaresh.kulal wrote: Yes we can use Casper policy but there is only limited option to select in scope where i can only select the building or individual computer, department, there is no option to select the Subnets of the each Floor.

If you create a policy manually - under the General Icon, you can select what network segments you want to deploy. If you configured your subnets into the JSS, you can deploy based on those subnets.

select the printer tab and add the desired printers.

so look under the general tab, not scope

Dan De Rusha

How to include the subnets, where the policy can initiated using Subnets of each floor where Mac workstations are present in those subnets. Thanks & Regards Kumaresh On Fri, Sep 3, 2010 at 12:11 PM, James Palmer <jamespalmer at smsd.org> wrote: > >I need a script that includes all the 40 scripts, so that it can > install > >the printers to all the floors & subnets it belongs to. > Or write one big script using a case statement to validate the conditions maybe? - JD
Casper mailing list Casper at list.jamfsoftware.com http://list.jamfsoftware.com/mailman/listinfo/casper
Casper mailing list Casper at list.jamfsoftware.com http://list.jamfsoftware.com/mailman/listinfo/casper

Not applicable

Thanks a lot... I got it.

I am just curious to know can these all network segments included in one
script, so that it point the installation to each floor.
This was what actually i was looking for.

Thanks & Regards
Kumaresh

stevewood
Honored Contributor II
Honored Contributor II

You cannot do it via policy without a script. Using the method above you
On Fri, Sep 3, 2010 at 11:48 AM, Kumaresh.kulal <kumaresh.kulal at gmail.com>wrote:
would have to create 40 policies to install printers, one for each floor.

If you want to do one policy you would need to identify what floor each
computer is on. If that is by subnet, then you would simply need to use a
sed/awk statement to grab the IP of the machine, then use a case statement
to run the proper add printer script.

#!/bin/bash

# floor is determined by 3rd octet of IP
# change the last awk statement if different octet

myFloor=`system_profiler | grep 'IPv4 Addresses' | awk '{ print $3 }' | sed
's/[.]/ /g' | awk '{ print $3 }'`

case $myFloor in
1) <your printer add script for first floor>
;;
2
) <your printer add script for second floor>
;;
*) #end the case test

I have not tested the case statement, but that should work. The numbers are
the octet numbers that you would use. For example, if this IP range
192.168.1.x is for your first floor, and 192.168.2.x is for your second
floor, and so on.

Hope that helps.

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

talkingmoose
Moderator
Moderator

I may not be understanding what you're after. I'm going to try to rephrase
On 9/3/10 11:48 AM, "Kumaresh.kulal" <kumaresh.kulal at gmail.com> wrote:
what I think you're wanting:

Option #1: You have 40 floors, each with a script to install printers on
your Macs just for that floor. What you want is one script to run on all
your Macs and do the same thing. Correct?

Option #2: Or do you want one script to install all printers on all floors
to all Macs on all floors?

I believe you are asking for Option #1.

My question to you is why is just one script important? By putting
everything into just one script, you may be reducing the number of scripts
you need to manage but you'll be increasing complexity of your one script.

Sometimes, managing a lot of smaller pieces is easier to manage and
understand than trying to manage one complex piece. Assuming that each
floor is its own network segment, define all 40 floors in your JSS and
scope each script to a particular network segment. If a Mac moves between
floors then it will get the printers for the new floor installed. This may
seem like a lot of work upfront but it will be easier to understand later.

Also, by defining your network segments in the JSS rather than your
script, you'll be able to scope other policies based on the network
segment.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

tlarkin
Honored Contributor

As long as you make the one mega script with "best practices," and simple case statements you can have one script for all 40 floors.

donmontalvo
Esteemed Contributor III

It was a little unclear to me too.

If #1, I agree, why not set up the subnets in JSS and proceed from there?

Don

--
https://donmontalvo.com

ernstcs
Contributor III

I also agree, if we had a little clearer understanding to the intent I think
we can help.

Using Network Segments in the JSS only helps if the network is really
segmented. Many places may only have one large subnet for several floors and
then this doesn't help.

Based on what is in the message it was a single script for everything. It
also sounds like you do have defined subnets so only certain printers get
added based on subnet.

I wouldn't do a script at all, and I would handle all of this with policies
in the JSS.

On a network change it can trigger a policy to install the printers for the
new subnet. Perhaps someone can help out with the network change piece, I
forget how people were doing that, but I thought it was possible.

Does your script remove any existing printers from other floors, or do
printers just keep getting added as that person goes from floor to floor.

Craig E

tlarkin
Honored Contributor

Casper can trigger policy based on network change? I think that might require some creative scripting. However, to back up what the others are saying, my network admin here has chopped everything up into so many VLANs that I know exactly what building the client is in and if they are on wireless or wired based by IP schema. You can add all these network segments into the JSS to scope out policy.

However, if you have traveling clients from subnet to subnet like I do, that will often change (because they are laptops) I am unaware of a way for Casper to detect what network segment you are in and trigger policy. Now, if you change subnets Casper can overwrite building/subnet location in the JSS based on your current location. However, policies may be a bit trickier. I suppose you could set up a run once policy and set the scope to a network segment, but what happens if that user travels back and forth often?

This may be a job for self service as well. Just depends on the needs/goals of what you want to accomplish. We have one building that is very, well they voice their opinions a lot, adamant about printing. Their printers are all over the place, so we just set up a self service item so the user can just add that way and you can only get the printers if you are on that network segment.

stevewood
Honored Contributor II
Honored Contributor II

Are you forgetting the SystemConfigTrigger in the Resource Kit? :-)
On Fri, Sep 3, 2010 at 1:14 PM, Thomas Larkin <tlarki at kckps.org> wrote:

http://jamfsoftware.com/kb/article.php?id=147

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

tlarkin
Honored Contributor

my bad, I stand corrected. I never have time to play with the resource kit :(

Not applicable

Using Network Segments in the *JSS* would have to create 40 policies to
install printers, one for each floor ?. correct me if am wrong.





*I have having the script created for each floor with 4 to 5 printers
included in it.(example: Floor-5-Leopard.sh)*
*Like this I have 40 scripts with same details of different floor.
*I need one script that will combine my previous script & install printers
to each floor using the subnets of each floor.*


*Thanks*
*Kumaresh

tlarkin
Honored Contributor

Can you at least post the script? You are going to have to do leg work either way. The nice thing about policy in the JSS is you can duplicate an existing policy which makes making many of the same or similar policies a snap. The downside to the script is, you have to maintain it, and what happens if the next guy has no clue what you were doing? If you do everything through Casper at least you will be setting a standard that everyone in IT can work with. Otherwise you end up with one guy writing a bunch of in-house code and not too many other people know whats going on. Been down that road before and while I comment all my code, most of my co-workers hate working from the command line let alone writing shell scripts.

donmontalvo
Esteemed Contributor III

Well said. Overcomplicating a task negatively impacts your ability to manage an environment. It catches up to you eventually. :)

Keep it simple. Use the tools and processes provided by Casper wherever possible and where it makes sense.

** Sent from my iPhone **

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor III

* Sent from my iPhone *

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor III

Hmmm...like JSS ability to reference flat files, Excel spreadsheets, etc... :)

--
https://donmontalvo.com