How does the non-domain member find strNetBIOSDomain ? On line 61, how about having it echo to the user what the strNetBIOSDomain and strUserName1 variables result in? Does it match what you think it should be? Is it possible to find that information from the workstation it's running on? Any reason you wouldn't run this as a web page from a domain member instead? Al
________________________________ From: [EMAIL PROTECTED] on behalf of Shawn Hayes Sent: Wed 8/31/2005 2:26 PM To: [email protected] Subject: [ActiveDir] VBscript to set a password for a user in AD but ran from a non domain member I am trying to write a script to set a user password and the script must be run from a machine that is not a domain member. Background: We are migrating to Exchange from Groupwise in 12 days. We still have a ton of machines that are not part of AD, still in NDS. Users all have accounts and mailboxes in AD. Many Novell users have not logged into AD. During our migration we would like the techs to quickly reset user passwords for those that do not know their AD passwords. Techs will be in the field at distributed locations to help with outlook connectivity. They will not know the existing password. When i run this from a non domain member I get "The specified domain either does not exist or could not be contacted". It runs fine from a domain member Here is the code - thanks to anyone that can help. 'Set a Users password 'Written by: Shawn Hayes 'Date: 8-31-05 'Variables Dim strUserName, strUserDN, strDNSDomain, strNetBiosDomain, strpassword, strpassword1, strpassword2 Dim strUserName1, strUserName2, strmsgresult, strcontinue, stradminID, stradminpwd, stradminpwd1, stradminpwd2 strNetBiosDomain = "ourdomainname\" Const ADS_NAME_INITTYPE_GC = 3 Const ADS_NAME_TYPE_NT4 = 3 Const ADS_NAME_TYPE_1779 = 1 Const ADS_PROPERTY_CLEAR = 1 Const ADS_SECURE_AUTHENTICATION = 1 'Input box prompts for UserID msgbox ("You must enter a userid with privledges in AD to change user passwords!") stradminID = InputBox ("Enter Your Admin account name used to connect to AD", "Enter Your Admin account name used to connect to AD", "") 'Input box prompts for admins password Do stradminpwd1 = InputBox ("Enter the Admin Password", " Admin Password", "") stradminpwd2 = InputBox ("Reenter the Admin password", "Admin Password", "") If stradminpwd1 <> stradminpwd2 then msgbox ("Admin Passwords do not match") strpassword = "nothing" Else strpassword = "equal" End IF Loop until strpassword = "equal" strpassword = "nothing" 'User information Do 'Input box prompts for UserID strUsername1 = InputBox ("Enter the Active Directory UserID", "Enter the Users Active Directory UserID", "") 'Input box prompts for users new password Do strPassword1 = InputBox ("Enter the new Password", "Password", "") strPassword2 = InputBox ("Reenter the password", "Password", "") If strpassword1 <> strpassword2 then msgbox ("Passwords do not match") strpassword = "nothing" Else strpassword = "equal" End IF Loop until strpassword = "equal" Set objNetwork = CreateObject("Wscript.Network") 'Connect to RootDSE 'Set objRoot = GetObject("LDAP://domaincontroller.ourdomain.com/RootDSE") 'Set objroot = GetObject("LDAP:") 'Set objDomain = objRoot.OpenDSObject("LDAP://cn=domain controller,OU=domain controllers,dc=ourdomain,dc=com", strNetBiosDomain & stradminID, stradminpwd1, ADS_SECURE_AUTHENTICATION) 'Set objDomain = objRoot.OpenDSObject("LDAP://dc=ourdomain,dc=com", strNetBiosDomain & stradminID, stradminpwd1, ADS_SECURE_AUTHENTICATION) 'strDNSDomain = objRootDSE.Get("defaultNamingContext") 'strDNSDomain = objdomain.Get("defaultNamingContext") 'Determine UsersDN from netbios name Set objTrans = CreateObject("NameTranslate") objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & strUserName1 strUserDN = objTrans.Get(ADS_NAME_TYPE_1779) strmsgresult = msgbox ("OK to change this user's password? " & struserdn, vbyesno) 'msgbox (strmsgresult) If strmsgresult = "6" then 'Set the Users Password 'Set objUser = GetObject ("LDAP://" & strUserDN) Set ObjDomain = GetObject ("LDAP:") Set objuser = ObjDomain.OpenDSObject("LDAP://domaincontroller.ourdomain.com/" & strUserDN, strNetBiosDomain & stradminID, stradminpwd1, ADS_SECURE_AUTHENTICATION) objUser.SetPassword strpassword1 Msgbox ("Password Set!") wscript.quit Else strcontinue = Msgbox ("Password not set, would you like to reenter the UserID?", vbyesno) If strcontinue <> "6" then wscript.quit End IF End IF Loop
<<winmail.dat>>
