3 Replies Latest reply on Oct 6, 2008 7:06 AM by ahe

    Help in Manage Local users And Groups by batch

    Rookie

      I Have a Problem,

       

            Im trying to edit local users and groups in each computer using Landesk, the problem is that I manually edit each computer one by one, what I usually do is delete local accounts and edit administrator accounts. By doing this it will take me about 2 months to edit local accounts and admin accounts in 2500 computers.

       

      Is there a way or a script to edit all those computers in 1 batch??

       

      Im sorry I really need help Im a newbie in this software, and haven't take any  training.

       

      Thanks,

       

      Joe

        • 2. Re: Help in Manage Local users And Groups by batch
          Rookie

          Hi Thanks for the reply ahe,

           

                 Thanks for the reply, in each computer there is a different local account, hmmm.. lets take it this way, all 2500 units has a unique local user account. how can i delete all of those local accounts in one process, and add or edit the built in account as admin.

           

           

          Thanks,

          Joe

          • 3. Re: Help in Manage Local users And Groups by batch
            ahe Expert

            Hello Joe,

             

            I hope I understand right:

             

            You want to delete some user accounts (no unique name) and some still remain (like administrator).

             

            If you want to create it with a batch you can try this (Attention: not tested!)

            @echo off
            REM list of users which should not delete: (you can edit this list, between every member a blank!)
            set "NoDelUsers=Administrator Guest"
            
            REM delete temporary file, if exist
            if exist %temp%\UserList.txt del %temp%\UserList.txt
            
            REM write user list in temporary file
            for /f "skip=4 tokens=1,2,3" %%i in ('net user^|findstr /v "successfully."') do @(echo %%i & echo.%%j & echo.%%k)>>%temp%\UserList.txt
            
            REM search for
            findstr /v "Administrator" %temp%\UserList.txt>%temp%\UserList2.txt&findstr /v "edv_tech" %temp%\UserList2.txt>%temp%\UserList2.txt&findstr /v "Guest" %temp%\UserList2.txt>%APATH%\users.txt
            
            for /f %%i in ('findstr /v "%NoDelUsers%" %temp%\UserList.txt') do ( 
                 echo delete unknown User %%i 
                 net user %%i /DELETE
                    REM create a logfile 
                 echo User %%i: -^> O.K. >>%temp%\deletedUsers.txt
                 echo. 
                    REM wait a bit between deletion... 
                 ping 127.0.0.1 -n 10 -w 10000 > NUL 
            )
            

             

            Regards

            Axel