Solved

VBS Script check user is enabled?

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show hidden user account 7 59
Script is being strange 8 70
vbscript to installing all steps of softwares automatically 7 18
VBScript on Html 11 17
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

832 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