Solved

VBS Script check user is enabled?

Posted on 2007-03-21
1
548 Views
Last Modified: 2012-05-05
How do i check if user existing in domain and is disabled?
0
Comment
Question by:dion_p1
1 Comment
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 18770053

Hey Dion,

What do you have to link to the user?

Checking whether they're disabled or not can be done like this. Both ways written seperately for clarity:


Const ADS_UF_ACCOUNTDISABLE = &H2

Set objUser = GetObject("LDAP://CN=SomeUser,CN=Users,DC=SomeDomain,DC=com")

intUAC = objUser.Get("userAccountControl")
If intUAC And Not ADS_UF_ACCOUNTDISABLE Then
    WScript.Echo "User is Not Disabled"
End If

If intUAC And ADS_UF_ACCOUNTDISABLE Then
    WScript.Echo "User is Disabled"
End If


Chris
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
A short film showing how OnPage and Connectwise integration works.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

937 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

10 Experts available now in Live!

Get 1:1 Help Now