<html>
  <head>
    <style type="text/css">
      <!--
        body { line-height: normal; font-variant: normal; margin-right: 4px; margin-left: 4px; margin-top: 4px; margin-bottom: 1px }
        p { margin-top: 0; margin-bottom: 0 }
      -->
    </style>
    
  </head>
  <body>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">Well&#44; where to start....</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">My environment is huge. &nbsp;Over 50 buildings&#44; over 30 servers over 6&#44;000 clients with most of them being Macbooks. &nbsp;It is a hassle to manage at times. &nbsp;I am not in charge of everything nor am I management&#44; so it puts me in a gray area at times when managing the client machines. &nbsp;We have local user accounts that have been created that I want gone&#44; however I am not sure what the names of those user accounts are. &nbsp;We had a password leak and some users promoted their own accounts to admin&#44; and I want to demote them. &nbsp;We have a naming convention that starts with their graduation year. &nbsp;So any user account under /Users that does not start with a number can be wiped&#44; with one exception&#44; the generic local account we created for local log ins just in case the network went down. &nbsp;That account is called student. &nbsp;I am trying to script something that will scan /Users and wipe out anything that does not start with a number. &nbsp;I got some help from a bit more advanced shell scripter than myself and came up with this so far:</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">&#35;&#33; /bin/sh</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">keep&#61;&quot;student&quot;</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">cd /Users</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">&#91;&#91; &#36;&#40;pwd&#41; &#33;&#61; &quot;/Users&quot; &#93;&#93; &amp;&amp; echo warning cd failed &amp;&amp; exit 2</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">for a in &#91;&#94;0-9&#93;&#42; &#59; do &#35; only loop over names that doen&#39;t start with a number</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">&nbsp;&nbsp;&nbsp;&nbsp;&#91;&#91; &quot;&#36;a&quot; &#61;&#61; &quot;&#36;keep&quot; &#93;&#93; &amp;&amp; continue &#35; skip that extra local account</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">&nbsp;&nbsp;&nbsp;&nbsp;/usr/bin/dscl . -delete /Users/&#36;a &#35; get rid of it</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">echo &#39;removing user files&#39;</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">/bin/rm -rf /Users/&#36;a</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">done</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">I haven&#39;t had a lot of time to test it but it basically kills everything in /Users except those that start with a number. &nbsp;My next questions are&#44; is there a Casper solution to this&#44; and how can I demote local accounts with Casper from a local admin to a mobile or managed local user&#63;</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">Thoughts&#63;</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">Thanks for anyone brave enough to read this.</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Lucida Grande" size="3">Tom</font>
    </p>
  </body>
</html>