Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 2004

Unlock User Accounts

RSS
Subscribe to Windows IT Pro | See More Active Directory (AD) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

EDITOR'S NOTE: Share your Windows and .NET discoveries, comments, problems, solutions, and experiences with products and reach out to other Windows & .NET Magazine readers (including Microsoft). Email your contributions (400 words or less) to r2r@winnetmag.com. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100. Submissions and listings are available online at http://www.winnetmag.com. Enter the InstantDoc ID number in the InstantDoc ID text box.

When I heard that you could delegate Active Directory (AD) tasks, I wondered whether I could use this feature to give departments the ability to unlock user accounts and thereby lighten my Help desk staff's workload. I decided to give unlock rights to several people in each department: the department manager or supervisor, two people who start work early, and two people who work late.

I created an AD group that contained these people and followed the instructions in the Microsoft article "How To Delegate the Unlock Account Right" (http://support.microsoft.com/?kbid=294952) to grant unlock rights to this group. Although my solution worked, the users with unlock rights had to open the Microsoft Management Console (MMC) Active Directory Users and Computers snap-in, click the organizational unit (OU), select the user whose account needed to be unlocked, open the user's properties, and clear the Account is Locked out check box. In an attempt to simplify the task, I added the Active Directory Users and Computers snap-in to a new MMC. I then created a new Taskpad View that showed only the OU containing the users from the target department. I distributed this MMC to the users with unlock rights. This method was easier but still required five or more clicks to unlock a user's account. In addition, this method let the users with unlock rights easily view other users' properties (e.g., account expiration).

To solve the problem, I adapted the MMC I had created. I configured an Unlock User Account button (i.e., task) on the Taskpad View. When you select a user and click the button, the Unlock.vbs script, which Listing 1 shows, runs to unlock the user—whether or not the user was locked out. For tracking reasons, the script also writes an event to one of our servers, noting who unlocked whom and when.

For relevance and simplicity, I also pared down the MMC Taskpad View to contain only three columns: the username, logon name, and object type (i.e., User). I configured the Unlock User Account button to run the Unlock.vbs script, passing the username (i.e., the value in column 0) as arguments.

The script concatenates the username into a Lightweight Directory Access Protocol (LDAP) name (I couldn't easily find the LDAP name to pass as an argument), then sets the LockoutTime attribute to 0. Clearing the LockoutTime attribute unlocks the account.

The script then notes that the user's account is unlocked and records the transaction details in the domain controller's (DC's) event log in which the user is logged on. Because of the nature of delegation, users can unlock only user accounts in their own OUs—except administrator accounts or their own accounts. In my organization, we also let users unlock backup user accounts (e.g., for staff who dial in to check backups).

You need to ensure that the snap-in is secure before you distribute it. Set the correct permissions on the file and script to prevent users from authoring the file or script or changing either's contents.

Department staff, rather than the Help desk staff, can now unlock user accounts. This method is simple and requires just one program and one click.

End of Article



Reader Comments
Sweet! This is exactly why I stopped the process to allow users to unlock user accounts. Too many mouse-clicks. I have no Taskpad or VB Script skills, so this will really help. Thanks Padraic.

David Perry March 01, 2004


This article sounds great. Is there an article on how to create a Taskpad View and then how to assign the VB script to it. Thanks

Keven Denton March 01, 2004


The script is written to handle multiple users, but it doesn't work that way for me. The script runs fine with only one user selected, but not with multiple users. On Windows 2000 with MMC 1.2, nothing happens when I click the Task icon. On Windows XP with MMC 2.0, the Task icon disappears completely so that I can't even click it.

Lee Gray March 02, 2004


For some reason when I try to run it, I get an error. Am I doing something wrong? The is as follows:
Script: c:\docs and settings\hd\admin tools\unlock.vbs
Line: 1
Char: 1
Error: Type mismatch: "Listing'
Code: 800A000D
Source: Microsoft VBScript runtime error

Can you please guide me back on track?

Thanks!
Best Regards,


Rob Spilman March 11, 2004


Ok, I fixed my script error. User error on my part. Now everytime I highlight a user in taskpad view and then click the unlock.vbs button, it always says no user selected. Little help please.

Rob Spilman March 11, 2004


Rob.

What may have been missing from the article was that the parameters for running the script in the taskpad view should be as below - including punctuation.

"$COL<0>"

This will pass the contents of Column 0 to the script.
Good Luck!


Padraic March 12, 2004


This script is going to be great, but I also having the same problem as Rob, I am always getting a no user selected error from the if/end if test.
Thanks


Jeff Waters March 15, 2004


When I click the Icon I get - an error of - A referral was returned from the server - it references the line for my OU and domain structure. Any idea what would cause that?

Troy Cosson March 25, 2004


What is This ? How is it supposed to work? Now I can see why this magazine plumets every month. Bring back the good people.

Gilles March 29, 2004


I am getting the error "Windows Script Host, Script: C:\41551\unlock.vbs, Line:13, Char:1, Error: A referal was returned from the server. Code: 8007202B, source: null

Todd March 29, 2004


 See More Comments  1   2   3 

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

More fun TechEd 2005 Resources

Kevin points out some more TechEd resources ...

WinInfo Short Takes: Week of October 13, 2008

An often irreverent look at some of the week's other news... ...


Related Articles Tools for Troubleshooting Locked-Out Accounts

Active Directory (AD) Whitepapers Sustainable Compliance: How to reconnect compliance, security and business goals

User Provisioning and Access Control

Managing Unix/Linux with Microsoft System Center Operations Manager 2007 Cross Platform Extensions Beta

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Windows 2003: Active Directory Administration Essentials

Related Active Directory (AD) Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Microsoft Exchange & Windows Connections event returns to Las Vegas Nov 10 - 13
Connections returns to Las Vegas for this exciting event where each attendee will receive SQL Server 2008 standard with 1 CAL. Co-located with Microsoft ASP.NET, SQL Server, and SharePoint Connections with over 250 in-depth sessions.

Free Online Event! Virtualization:Get the Facts!
Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)!

Check Out Hyper-V Video on ITTV
Watch Karen Forster's interview on Hyper-V's performance on ITTV.net.

Ease Your Scripting Pains with the Flexibility of PowerShell!
Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!

Latest Advancements in SSL Technology
There are a variety of different kinds of SSL to explore to ensure customer data is kept confidential and secure. In this paper, we will discuss some of these SSL advances to help you decide which would be best for your organization.

PASS Community Summit 2008 in Seattle on Nov 18-21
The don’t-miss event for Microsoft SQL Server Professionals. Register now and you’ll enjoy top-notch Microsoft and Community speakers and more.



Solving PST Management Problems
In this white paper, read about the top PST issues and how to administer local/network PST Files.

Get Protected -- Data Protection Manager 2007
Protect your virtualized environment with Data Protection Manager

Order Your SQL Fundamentals CD Today!
Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.

Maximize Your SharePoint Investment: Get Your Data Moving
Watch this web seminar now to learn how to maximize your SharePoint investment! Join us as we take a look at the complex business of securing, accessing and managing vast amounts of information in a global network and various ways to get your data moving.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing