Solved

check if a user account is locked and then auto unlock

Posted on 2013-05-29
4
3,085 Views
Last Modified: 2013-06-14
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.
0
Comment
Question by:Jason Thomas
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Jaroslav Mraz earned 500 total points
ID: 39203863
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
 
LVL 1

Author Comment

by:Jason Thomas
ID: 39203992
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
 
LVL 15

Expert Comment

by:Jaroslav Mraz
ID: 39204085
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
 
LVL 1

Author Closing Comment

by:Jason Thomas
ID: 39247148
Thanks
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now