<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&#63;</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. &nbsp;&nbsp;First and foremost I suggest anyone who manages Macs to keep their local admin accounts hidden&#44; in like /private/var for example. &nbsp;That way it keeps them out of the /Users directory. &nbsp;Then all of your policies in place for your managed users can loop through the /users directory. &nbsp;Since the admin accounts won&#39;t be there you won&#39;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&#44; 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">&#35;&#33;/bin/bash</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Lucida Grande" size="3">&#35;get current user logged in</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Lucida Grande" size="3">current_user&#61;finger -lp&nbsp;&#124;&nbsp;grep Directory&nbsp;&#124;&nbsp;cut -c 19-40</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Lucida Grande" size="3">&#35;now loop through users</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Lucida Grande" size="3">for i in &#96;ls /Users&#96;</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 &#91;&#91; &#36;i &#61;&#61; &#36;current_user &#93;&#93;</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 &quot;not in /Users&quot;</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. &nbsp;That is where I would start though.</font><br><br><br>___________________________<BR>Thomas&nbsp;Larkin<BR>TIS&nbsp;Department<BR>KCKPS&nbsp;USD500<BR><a href="mailto:tlarki@kckps.org">tlarki@kckps.org</a><BR>blackberry:&nbsp;&nbsp;913-449-7589<BR>office:&nbsp;&nbsp;913-627-0351<BR><BR><BR><BR><br><br>&gt;&gt;&gt; Matt Oclassen &lt;moclassen@salesforce.com&gt; 05/07/09 1:32 PM &gt;&gt;&gt;<br>    </p>
    <div style="font-size: 11pt">
      <p style="margin-top: 0; margin-bottom: 0">
        Hello&#44;<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 &#40;as opposed to a machine being on&#44; but sitting at the login screen&#41;<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 &#40;except for our 2 admin accounts whose name I can specify&#41;<br><br>Execute&nbsp;&#160;jamf policy&#160;&#8211;trigger&#160;&#8220;custom trigger&#8221;<br><br>Else quit.<br><br>Does anyone have an idea on the scripting for this&#63;<br><br>Thanks very much&#44;<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>