WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Create Enable and Disable User Account


AddExtender("wwads44i.dll")

; Container
sAdsiPath = "LDAP://shamrock/CN=Users,DC=jclass,DC=org"

; Create a user object
sObjectClass = "User"
sUserName    = "CN=Bill Money"
sUserPath    = dsCreateObj(sAdsipath, sObjectClass, sUserName)

; Set the manditory properities.
sProperty = "samAccountName"
sValue    = "bmoney"
dsSetProperty(sUserPath, sProperty, sValue)

; Disable account when created.
UF_ACCOUNTDISABLE = 2
nValue = UF_ACCOUNTDISABLE
dsSetProperty(sUserPath, "userAccountControl", nValue)

; Create the user account on the server.
dsSetObj(sUserPath)

dsSetPassword(sUserPath, "", "*topsecret*")

; Finally, enable the account
nValue = dsGetProperty(sUserPath, "userAccountControl")
nValue = nValue ^ UF_ACCOUNTDISABLE  ; Could also use  nValue = nValue | (~UF_ACCOUNTDISABLE)
dsSetProperty(sUserPath, "userAccountControl", nValue)

Article ID:   W17370
File Created: 2008:04:10:15:08:30
Last Updated: 2008:04:10:15:08:30