disable accounts
we have script creating user accounts staff. use first name initial + last name upto 8 letters. if there same firstname user first 2 letters of firstname +lastname, if there 3 user first 3 firstname + last name. works fine. in script have part of disabling accounts. uses first letter of first name +last name diable accounts. results wrong user disabled, because both have same first initial +lastname.
seems best way through unique identifier. have unique number identify user in feed file, didn't use in ad yet. best way resolve issue? i'm thinking set field in ad unique number, not sure field should be. maybe can use get-qaduser along parameter unique number user's samaccountname disable it.
know in our case don't sid.
suggestions in ad store unique number? thanks
first, i'm sure strings case insensitive in queries quest cmdlets. next, query seems require 3 attributes, givenname, sn, , samaccountname, should have designated values. however, think have found samaccountname not have value calculate. think have better chance of uniquely identifying user if you query on givenname (first name) , sn (last name). more unique <first initial>.<last name>, why user creation code selects alternate samaccountname value in cases. in other words, suggest:
$usertodisable=get-qaduser -searchroot $ou2 -firstname $fname -lastname $lname
richard mueller
mvp adsi
Windows Server > Windows PowerShell
Comments
Post a Comment