| |
brandonrjackson
Posts: 2
Score: 0
Joined: 7/15/2008
Status: offline
|
I have a (hopefully) very basic question. I am trying to utilize the ADS_NAME_INITTYPE_GC lookup to query our Global Catalog Server and do a ADS Name Translation. However, I get error code -2147463160 (0x80005008) on the line. Everything is written (as near as I can tell) exactly like it states on the MSDN site, but I cannot get it to work (and since it won't initialize, I cannot set or translate the name). Here is the code snippet: Set adsNameTranslate = CreateObject("NameTranslate") adsNameTranslate.Init ADS_NAME_INITTYPE_GC, "" adsNameTranslate.Set ADS_NAME_TYPE_DOMAIN_SIMPLE, username2 userDN = adsNameTranslate.Get (ADS_NAME_TYPE_1779) The "username2" variable (defined earlier in the script) is username@domain.com. I want to translate that into the full DN of the user. The error code says that I have an ADS_BAD_PARAMETER, but I cannot figure out what is wrong (it is a very basic call). Any help would be appreciated. Thanks! For reference (to show this is not a complicated script), the entire script is below (actual domain name has been changed to domain.com). I am creating a script that will prompt the user to enter a username, and then have it translate to the DN and disable the account. dim username dim datestamp dim userDN dim username2 username= InputBox( "Enter Username to be disabled") datestamp= InputBox( "Enter datestamp to be added to Description field") username2 = username & "@domain.com" ' Use NameTranslate (ADSI) to translate SAM account name to Display Name Set adsNameTranslate = CreateObject("NameTranslate") adsNameTranslate.Init ADS_NAME_INITTYPE_GC, "" adsNameTranslate.Set ADS_NAME_TYPE_DOMAIN_SIMPLE, username2 userDN = adsNameTranslate.Get (ADS_NAME_TYPE_1779) 'Disable Account Set ou = GetObject("LDAP://OU=Test,DC=domain,DC=com") Set ObjUser = GetObject ("LDAP://" & userDN) objUser.AccountDisabled = True objUser.SetInfo Wscript.echo "Account is now disabled" wscript.quit
|
|