How to enable user account in Active Directory through vbscript

Below is the sample vbscript to enable the user from Active Directory

Set objOU = GetObject("LDAP://TestDC/OU=TestUO,DC=Test,DC=com")
Set objUser = GetObject("LDAP://CN=TempUser,OU=TestOU,DC=Test,DC=com")
objUser.AccountDisabled = FALSE
objUser.SetInfo
Wscript.echo "Successfully enabled TempUser from Test.Com"

Note: Before executing above script please make sure that the user with samaccount name TempUser exist in the domain and OU with name TestOU exists under Test.Com root container.

No comments:

Post a Comment

Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...