[Casper] Running inventory reports by partition schema

Thomas Larkin tlarki at kckps.org
Fri Feb 13 14:34:32 PST 2009


Thanks for your help it works as I have tested it out manually on my
Macbook pro, which doesn't dual boot.  So, when we come back to school
on Tuesday and everyone is hitting the network I should get a full
report of how many machines do not have windows. 

Dummy packages are very neat idea.


___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry:  913-449-7589
office:  913-627-0351





>>> Miles Leacy <miles.leacy at themacadmin.com> 02/13/09 11:18 AM >>>
No problem. 


The name of the policy isn't important; the trigger is.  In the
execution options section of the policy's general tab, choose "other
(Manually specify the run at action in this field) -->" from the
"triggered by" drop down menu.  In the text field next to that menu,
type your custom trigger ("flagForWindows" in my example).


The command below will run your policy, and any other policies for which
you choose to specify "flagForWindows" as a custom trigger. 



jamf policy -trigger flagForWindows 





This command also works with the standard triggers, i.e.: 



jamf policy -trigger every15

jamf policy -trigger login

jamf policy -trigger startup

etc... 


----------
Miles A. Leacy IV

 Certified System Administrator 10.4
 Certified Technical Coordinator 10.5
 Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com





On Fri, Feb 13, 2009 at 12:05 PM, Thomas Larkin 
<tlarki at kckps.org> 

wrote:


Awesome Miles, thanks, you rock 


One more quick question.  Since I don't ever trigger custom packages, I
just name the policy whatever, then use the trigger option with the
policy name behind it? 


Thanks again for your help 



___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry:  913-449-7589
office:  913-627-0351






>>> Miles Leacy <miles.leacy at themacadmin.com> 02/13/09 10:49 AM >>> 



Here's what I'd do and why... 





#!/bin/bash 



# Find ntfs partitions.  If you have no ntfs partitions, `df -T ntfs`
will return nothing. 

# If there are ntfs partitions, you'll get output that looks like: 

# /dev/disk0s4   32358320     73712  32284608     1%    /Volumes/DevDisk




hasntfspart=`df -T ntfs | grep -c /` 



# $hasntfspart now = 0 if there are no ntfs partitions, and >0 if there
are any. 



# Install a dummy package if an ntfs partition is found. 

# I always install my dummy packages via policies, using custom
triggers. 

# Create your dummy package, and a custom-triggered policy to install
it. 

# In this example, I use flagForWindows as my custom trigger. 

# The name of the package is unimportant for the purposes of this
script. 



if [ $hasntfspart -ne 0 ] 

  then jamf policy -trigger flagForWindows 

  else echo "no ntfs partition found" 

fi 



# The jamf binary contacts the JSS and runs any policies that have a
trigger of 

# "flagForWindows" if the value of $hasntfspart is >0. 

# That's it. 

# If you want to be elegant about your coding, you can throw an `exit`
in at the end. 


----------
Miles A. Leacy IV

 Certified System Administrator 10.4
 Certified Technical Coordinator 10.5
 Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com





On Fri, Feb 13, 2009 at 11:19 AM, Thomas Larkin 
<tlarki at kckps.org> 

wrote:


Ok advanced casper users....OK, well I mean Miles... 
  
I have written the following script I want to run to install a dummy pkg
to make a smart group on machines that have windows or not.  So, here is
my script, but I am not quite piecing it all together.  I think I am
missing a few small steps 
  
#!/bin/bash 
  
#determine if there is an NTFS volume on a mac, and run casper policy
accordingly. 
  
fs=/bin/df -T ntfs 
  
for a in /bin/df -T ntfs ; do 
  
  So I should just create a blank package and call it, Winders XP or
whatever.  Then put it in Casper Admin and sync the shares.  Then set
the trigger to custom.  Then I should make that script another policy
and have it execute say, every hour once a day or whatever.  Then apply
it to all my user machines.  The machines that have windows will be
ignored and the ones that do have it will get that dummy package
installed.  Then I can create a smart group off the receipts.... 
  
This is my first time using a dummy package like this, so any pointers
would be greatly appreciated.  I also just wrote that script 5 minutes
ago and only had 1 cup of coffee and am still learning how to properly
code loops in shell scripts, so if my syntax is off, well I could use
pointers there as well. 
  
Thanks, 



___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry:  913-449-7589
office:  913-627-0351






>>> Miles Leacy <miles.leacy at themacadmin.com> 01/30/09 12:35 PM >>> 




A dummy package is just an empty package.  Name it something appropriate
and recognizable such as "windowsMachines.pkg". 







Create a policy with a custom trigger to install this package. 



Create a second policy that runs on all of your machines which runs the
script that I half-wrote in my last message.  That script issues the
custom trigger for the policy to install the dummy package if it finds
an NTFS volume. 



What you end up with is each machine that has an NTFS volume also has a
receipt for windowsMachines.pkg.  You then create a smart group whose
criteria is machines with the windowsMachines.pkg receipt.


----------
Miles A. Leacy IV

 Certified System Administrator 10.4
 Certified Technical Coordinator 10.5
 Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com





On Fri, Jan 30, 2009 at 1:29 PM, Thomas Larkin 
<tlarki at kckps.org> 

wrote:


will this dummy package log only machines that have windows then in the
policy logs?  How exactly does this work?

>>> Miles Leacy <miles.leacy at themacadmin.com> 01/30/09 12:07 PM >>> 




Dummy package.  Loop through your /Volumes with: 







haswindows=`diskutil info $volume | grep -c NTFS` 



if [ $haswindows -ne 0 ] ; then 



issue the custom trigger to install the dummy package.  Scope your smart
group to the existence of the dummy package. 



You may want to double check that "NTFS" is what you want to grep for. 
I don't have any NTFS volumes to test this with.

----------
Miles A. Leacy IV

 Certified System Administrator 10.4
 Certified Technical Coordinator 10.5
 Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com





2009/1/30 Thomas Larkin 
<tlarki at kckps.org> 




We now have a need to figure out how many machines have windows on them
or not.  I would like to run a report with Casper that will go through
inventory and if a Mac doesn't have a NTFS partition on it with Windows
I want it on one list, and if it does I want it on another list so we
can tell what machines dual boot and which ones don't. 


Any ideas? 

___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry:  913-449-7589
office:  913-627-0351







_______________________________________________
Casper mailing list
Casper at list.jamfsoftware.com
http://list.jamfsoftware.com/mailman/listinfo/casper










-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090213/8cff9c0a/attachment.htm 


More information about the Casper mailing list