Solved

check if a user account is locked and then auto unlock

Posted on 2013-05-29
4
3,132 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

860 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