<html>
<head>
<style type="text/css">
<!--
body { margin-left: 4px; margin-top: 4px; font-variant: normal; margin-bottom: 1px; line-height: normal; margin-right: 4px }
p { margin-top: 0; margin-bottom: 0 }
-->
</style>
</head>
<body content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">Are these accounts local or part of a directory?</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">This could be easily done a few different ways. First and foremost I suggest anyone who manages Macs to keep their local admin accounts hidden, in like /private/var for example. That way it keeps them out of the /Users directory. Then all of your policies in place for your managed users can loop through the /users directory. Since the admin accounts won't be there you won't loop them out at all.</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">I kind of just came up with a quick way to do this, probably not that efficient and someone who is a better script writer may want to try it.</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">#!/bin/bash</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">#get current user logged in</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">current_user=finger -lp | grep Directory | cut -c 19-40</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">#now loop through users</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">for i in `ls /Users`</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">do</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">if [[ $i == $current_user ]]</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">then jamf policy -trigger MyPolicy</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">else echo "not in /Users"</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">fi</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">exit</font> </p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">done</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Lucida Grande" size="3">This was written very quick and you may want to write it a better way. That is where I would start though.</font><br><br><br>___________________________<BR>Thomas Larkin<BR>TIS Department<BR>KCKPS USD500<BR><a href="mailto:tlarki@kckps.org">tlarki@kckps.org</a><BR>blackberry: 913-449-7589<BR>office: 913-627-0351<BR><BR><BR><BR><br><br>>>> Matt Oclassen <moclassen@salesforce.com> 05/07/09 1:32 PM >>><br> </p>
<div style="font-size: 11pt">
<p style="margin-top: 0; margin-bottom: 0">
Hello,<br><br>I was looking for a command that I could use to verify that a user is logged onto their machine before a policy is run (as opposed to a machine being on, but sitting at the login screen)<br><br>I want to make sure that they are logged in so they are sure to get the messaging that this policy has run.<br><br>I am imagining something like the following:<br><br>If any user is logged in (except for our 2 admin accounts whose name I can specify)<br><br>Execute  jamf policy –trigger “custom trigger”<br><br>Else quit.<br><br>Does anyone have an idea on the scripting for this?<br><br>Thanks very much,<br>Matt Oclassen<br><br>Desktop Systems Specialist<br> </p>
</div>
<div style="font-size: 18pt">
<p style="margin-top: 0; margin-bottom: 0">
sales </p>
</div>
<div style="font-size: 18pt">
<p style="margin-top: 0; margin-bottom: 0">
<font color="#FF0000">force</font><font color="#00007F">.</font><font color="#7F7F7F">com<br style="color: #7F7F7F"></font> </p>
</div>
<div style="font-size: 10.5pt">
<p style="margin-top: 0; margin-bottom: 0">
<br>
<br>
<br>
</p>
</div>
</body>
</html>