• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 564
  • Last Modified:

VBS Script check user is enabled?

How do i check if user existing in domain and is disabled?
0
dion_p1
Asked:
dion_p1
1 Solution
 
Chris DentPowerShell DeveloperCommented:

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now