check if a user account is locked and then auto unlock

Hi all,
We currently run a batch file each morning to check if important domain monitoring accounts are locked, there are 4 accounts. Batch example is:

net user user1 /domain | FIND /I "account active"
net user user2 /domain | FIND /I "account active"
net user user3 /domain | FIND /I "account active"
net user  user4 /domain | FIND /I "account active"

If any of the accounts are locked we trpe in from the command lind: c:\>user1.bat
User1.bat is simply: Net user user1 /DOMAIN /active:YES

I was wondering whether there was a way of combining the two where-by if on teh first batch file an account is locked it will unlock it, if you know what i mean?

Thanks as always.
LVL 1
Jason ThomasAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jaroslav MrazConnect With a Mentor CTOCommented:
You can simple use only NET USER1 /DOMAIN /active:YES script it doesn't meter if it is active or not. Or do you log it somewhere?

NET USER1 /DOMAIN /active:YES
NET USER2 /DOMAIN /active:YES
NET USER3 /DOMAIN /active:YES
NET USER4 /DOMAIN /active:YES
0
 
Jason ThomasAuthor Commented:
Cool mate, nope we don't log it so if teh account is active and we run that command it sees it as active and does nothing?
0
 
Jaroslav MrazCTOCommented:
Yop,

it maybe write you back error that acount is alredy activated :) but nothing else cause this switch only setting this one parameter to YES.


http://support.microsoft.com/kb/251394
0
 
Jason ThomasAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.