Scripts Thread, Removing home folders of non existing users in Coding and Web Development; I thought I had knocked up a batch file that would do this, however it ended up resetting everyones password ...
-
30th March 2012, 10:39 AM #1
- Rep Power
- 0
Removing home folders of non existing users
I thought I had knocked up a batch file that would do this, however it ended up resetting everyones password which was impressive
. I still dont understand why it did that but if anyone can see it would be appreciated
@echo off
setlocal
#cycle through each folder and set username as foldername
for /f "Tokens=*" %%a in ('dir c:\vol1\staff /b /ad') do (
set user=%%a
call :get
)
endlocal
goto :EOF
:get
set OK=N
call :quiet>nul 2>&1
if "%OK%" EQU "Y" goto :EOF
@echo %user%
move /Y c:\vol1\staff\%user% c:\vol1\archive\staff
goto :EOF
:quiet
#check if user exists in AD
for /f "Tokens=*" %%b in ('net user %user% /domain empire^|Find "completed"') do (
set OK=Y
)
-
-
IDG Tech News
SHARE: 
Similar Threads
-
Replies: 4
Last Post: 1st February 2011, 10:27 AM
-
By matte53 in forum Windows 7
Replies: 0
Last Post: 30th June 2010, 10:00 AM
-
By Arcath in forum Windows 7
Replies: 1
Last Post: 24th February 2010, 03:43 PM
-
By itschad in forum Wireless Networks
Replies: 4
Last Post: 12th September 2008, 05:03 PM
-
By baronne in forum Scripts
Replies: 0
Last Post: 20th August 2007, 02:20 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules