Skip to main content

Does anyone know if there is documentation anywhere on Using $1, $2, $3
in scripts to cycle through the users etc.... I know this has been
discussed a bit before but in digging around the KB and the resource kit
I can find it in use but would like to review an documentation
available. I've got to make some scripts to deal with some imaging
issues we had previously and being able to cycle through all the
existing users would be of great help.



Thanks folks, I'm sure I'm missing something easy. Still adjusting to
this daylight savings time thing can't get the brain working right this
week.



-Dusty-



Dustin Dorey



Technology Support Cluster Specialist



ISD 196 Apple Valley, Eagan, Rosemount



dustin.dorey at district196.org



952|423|7971

The Casper Suite Documentation doesn't explicitly state this, but it implies
the values of these variables on page 170.
$1 = Mount point of the target drive. This is / if you're booted to the
target or /Volumes/targetDrive if you're not booted to it.



$2 = the computer name



$3 = the current user's shortname. Note that this is not a loop, and $3
doesn't mean "do this to all users". If you use $3 in a script that is used
in a login or logout policy, or a Casper Remote action that is run while a
client is logged in, that $3 will equal the current user's username. If no
one is logged in, I believe $3 will be empty.



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



? Certified System Administrator
? Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com


Page 170 of the Casper Suite 6.0 Documentation.pdf talks about scripts
briefly, and refers you to the example scripts. The example scripts
that come with Casper (they would've been in the original installation
DMG) show that $3 is the current user (although it is only populated
if the script is called at login or logoff.)



The 'w' and 'who' commands will give the users who are currently
logged in. I think



who | grep console | cut -d " " -f 1



will probably be the best way to get a list of all users logged in
graphically.



As for getting a list of all users who have accounts on the machine,
if they are all in the Users folder, you could do something like this:



for USER in `ls /Users` ; do echo $USER ; done



If your users aren't all in the Users folder, you probably have to
move on to using dscl, and it'll take a bit more effort.



Lastly, Casper has facilities to "Fill User Templates" (FUT) and "Fill
Existing Users" (FEU), which helps if you need to create or modify a
file for all users. Or, to really make use of the $3 parameter, you
should create a script that runs at login, scheduled to run once for
each user.



I hope this answers your question.



Cheers,
Clinton


That's the ticket, I was trying to write too much into the script, I'll
strip it down and just run once per user on each machine in the policy.
We've got an issue with a library file that has the incorrect
permissions that needs to be fixed on each user on the machine,
including our bound accounts which really is where I hit the wall.



Thanks for the responses Miles and Clinton!



-Dusty-


Reply