Solved

VBS Script check user is enabled?

Posted on 2007-03-21
1
546 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

11 Experts available now in Live!

Get 1:1 Help Now