1 2 3 Previous Next 56 Replies Latest reply on Jul 22, 2010 1:36 PM by SafeBoot

    how to delete old disabled user on v5.2.3 database

      I want to start a script that can delete disabled users older then 60 days.  I found a script that is supposed to delete old users, but I need some to help with this script, because my condition is that the user has to be disabled for more then 60 days. I beleive tha script below deltes users and machines that older then 60 days, but I do not know how to set the variable disabled=true as the condition for deleting.  Also, I have no idea how to run it once I get to do what I need.

       

      Here is the script below:

      @echo off
      rem *******************************************************************
      rem DeleteUser/DeleteMachine v1.0.0 (c) SafeBoot Corp. 2007
      rem Author - SafeBoot
      rem *******************************************************************

      rem *******************************************************************
      rem This script automates the process of deleting old users and old
      rem machines from the database.
      rem *******************************************************************

      rem *******************************************************************
      rem Set command variables used within the script
      rem *******************************************************************
      set OldUserGroup=*
      set OldMachineGroup=*
      set UserDaysOld=61

      set MachineDaysOld=61

      rem *******************************************************************
      rem Connect with the following credentials
      rem *******************************************************************
      set AdminUser=SBBkup
      set AdminAuth=-adminpwd:12345
      set DatabaseString=-database:"SafeBoot Administration Database"

      rem *******************************************************************
      rem Begin ShowOldUsers/DeleteUser process
      rem *******************************************************************

      "C:\Program Files\SBAdmin\sbadmcl" -adminuser:%AdminUser% %AdminAuth% %DatabaseString% -command:ShowOldUsers -Group:%OldUserGroup% -DaysOld:%UserDaysOld% -OutputFile:"C:\Temp\OldUsers.txt"

      for /F "eol=; tokens=1,2 usebackq delims=," %%i in ("C:\temp\OldUsers.txt") do "C:\Program Files\SBAdmin\sbadmcl" -adminuser:%AdminUser% %AdminAuth% %DatabaseString% -command:DeleteUser -User:"%%i" -Group:"%%j" -Recycle:True

      rem *******************************************************************
      rem End ShowOldUsers/DeleteUser process
      rem *******************************************************************

      rem *******************************************************************
      rem Begin ShowOldMachines/DeleteMachine process
      rem *******************************************************************
      "C:\Program Files\SBAdmin\sbadmcl" -adminuser:%AdminUser% %AdminAuth% %DatabaseString% -command:ShowOldMachines -Group:%OldMachineGroup% -CheckForSeq:No -DaysOld:%MachineDaysOld% -OutputFile:"C:\Temp\OldMachines.txt"

      for /F "eol=; tokens=1 usebackq delims=," %%i in ("C:\Temp\OldMachines.txt") do "C:\Program Files\SBAdmin\sbadmcl" -adminuser:%AdminUser% %AdminAuth% %DatabaseString% -command:DeleteMachine -Machine:"%%i" -Recycle:True

      rem *******************************************************************
      rem End ShowOld Machines/DeleteMachine process
      rem *******************************************************************

      :TheEnd

        1 2 3 Previous Next