srochford Posted October 16, 2008 Posted October 16, 2008 On the off change, is there anyway of forcing it all in lowercase? As it stands I've got an email addresses reading as [email protected]. assume it makes no difference, but I'm funny about things like that! Use lcase: objUser.put "mail", lcase(left(objUser.Get("givenname"),1) & objUser.Get("sn")) & "@lordswdg.bham.sch.uk" 1
machin05 Posted October 16, 2008 Author Posted October 16, 2008 Use lcase: objUser.put "mail", lcase(left(objUser.Get("givenname"),1) & objUser.Get("sn")) & "@lordswdg.bham.sch.uk" Thanks a lot mate, perfect. One last question (maybe!), how could I incorporate this line of code for replacing the . $email = Replace(objUser.Get("sAMAccountName"),".","")) Whereabouts does it need to go? Thanks again, Will
apeo Posted October 16, 2008 Posted October 16, 2008 Thanks a lot mate, perfect. One last question (maybe!), how could I incorporate this line of code for replacing the . $email = Replace(objUser.Get("sAMAccountName"),".","")) Whereabouts does it need to go? Thanks again, Will Something like this i guess: lcase(Replace(objUser.Get("sAMAccountName"),".",""))) 1
apeo Posted October 16, 2008 Posted October 16, 2008 replace is nice and works well in this specific case. The good thing about getting different examples is that it shows people other options. Our email addresses are of the form .@ etc and for this the "left" function is needed because samaccountname won't give you that at all. yeah i meant in this case its cleaner to use replace but the other option is always there
machin05 Posted October 16, 2008 Author Posted October 16, 2008 Cheers everyone, Got it sorted and working. Have successfully changed all staff entries. Much appreciated. My final script looked like this: Set objParent = GetObject("LDAP://OU=Staff,OU=Moodle,DC=lordswoodgirls,DC=school") objparent.Filter = Array("user") for each objUser in objParent 'Wscript.Echo "Modifying " & objUser.Get("sAMAccountName") objUser.put "mail", lcase(Replace(objUser.Get("sAMAccountName"),".","")) & "@lordswdg.bham.sch.uk" objuser.Setinfo next Wscript.Echo "Done ;)" Thanks again, Will
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now