EDN Admin
Well-known member
<br/>
<pre class="prettyprint Option Explicit
Dim objOU, objDelUser
Dim objContainer, objRootLDAP, strObject, strDNSDomain
Dim FName, LName, userFullName
Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://RootDSE")
Set objContainer = GetObject("LDAP://CN=Users," & _
objRootLDAP.Get("defaultNamingContext"))
FName = "C"
LName = "D"
Try to Create User
DeleteUser FName, LName
FUNCTION DeleteUser(FName, LName)
FName = TRIM(FName)
LName = TRIM(LName)
userFullName = FName & " " & LName
Set objDelUser = objContainer.Delete("User", "cn=" & userFullName)
Set DeleteUser = objDelUser
END FUNCTION
wscript.quit
[/code]
I Created this VBScript and Im having a trouble on this.
when i execute the vbscript that i created on the AD the AD user will be Deleted but an error will POP - UP and here is the Error
Error: Object RequiredbjectContainer.Delete(...) <br/>
Code: 800A01A8 <br/>
Source: Microsoft VBScript runtime Error
What should I do to Fix this one?
Thanks
Paul.
View the full article
<pre class="prettyprint Option Explicit
Dim objOU, objDelUser
Dim objContainer, objRootLDAP, strObject, strDNSDomain
Dim FName, LName, userFullName
Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://RootDSE")
Set objContainer = GetObject("LDAP://CN=Users," & _
objRootLDAP.Get("defaultNamingContext"))
FName = "C"
LName = "D"
Try to Create User
DeleteUser FName, LName
FUNCTION DeleteUser(FName, LName)
FName = TRIM(FName)
LName = TRIM(LName)
userFullName = FName & " " & LName
Set objDelUser = objContainer.Delete("User", "cn=" & userFullName)
Set DeleteUser = objDelUser
END FUNCTION
wscript.quit
[/code]
I Created this VBScript and Im having a trouble on this.
when i execute the vbscript that i created on the AD the AD user will be Deleted but an error will POP - UP and here is the Error
Error: Object RequiredbjectContainer.Delete(...) <br/>
Code: 800A01A8 <br/>
Source: Microsoft VBScript runtime Error
What should I do to Fix this one?
Thanks
Paul.
View the full article