Re: Script help please (unlock locked out accounts) NEWBIE question.
- From: "Richard Mueller" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Aug 2006 21:11:41 -0500
Hi,
What most people call the login ID is the NT Name, also called the
"pre-Windows 2000 logon name". This is actually the value of the
sAMAccountName attribute. This is different from the Common Name (the value
of the cn attribute), although they can have the same value. If you have the
NT name (sAMAccountName) of the user, you can use the NameTranslate object
to convert this to the Distinguished Name required for the LDAP provider.
See this link:
http://www.rlmueller.net/NameTranslateFAQ.htm
Using NameTranslate there is no need to prompt for the OU. I hope this
helps.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
"Clubsprint" <spamspamspamspam@xxxxxxxxxx> wrote in message
news:ec0em2$ice$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
G'day all
I've got two questions if you will
The below script (that I hacked together )will unlock a users active
directory account
that has entered the wrong password too many times but I have a
problem with the user interface. I want our helpdesk people to be
able to use the loginID instead of the users full name.
How can I get the fullname from a user input of the loginID
so that I can then use that in the GETOBJECT section?
How can I find out all the options for objUser ?
I suppose this is some sort of comand reference
Thanks regards
Mark
Aus
*****SCRIPT START**************************
'Get the user name
UserLOGID = InputBox("Enter the Login ID of the User you wish to unlock")
'if Cancel selected - exit
If (UserLOGID = "") Then Wscript.Quit
'Get the Organizational Unit
OrgInput=InputBox( _
"Select the Organizational unit by number" & vbCRLF & vbCRLF _
& " 1 - SITE1" & vbCRLF _
& " 2 - SITE2" & VbCrLf _
& " 3 - SITE3" & vbCRLF _
& " 4 - SITE4" & vbCRLF _
& " 5 - SITE5" & vbCRLF _
& " 6 - SITE6" & vbCRLF _
& " 7 - SITE7" & vbCRLF & VbCrLf )
'if Cancel selected - exit
If (OrgInput = "") Then Wscript.Quit
If (OrgInput = "1") Then OrgUnit="SITE1"
If (OrgInput = "2") Then OrgUnit="SITE2"
If (OrgInput = "3") Then OrgUnit="SITE3"
If (OrgInput = "4") Then OrgUnit="SITE4"
If (OrgInput = "5") Then OrgUnit="SITE5"
If (OrgInput = "6") Then OrgUnit="SITE6"
If (OrgInput = "7") Then OrgUnit="SITE7"
MsgBox ("You're unlocking "& UserLOGID & VbCrLf _
& "from Organizational Unit "& OrgUnit)
'error check input
If (INSTR("1234567",Action)=0) OR (Len(Action)>1) then
y = msgbox("Unacceptable input passed -- '" & OrgUnit & "'", _
vbOKOnly + vbCritical, "That was SOME bad input!")
Wscript.Quit
End If
Set objUser = GetObject _
("LDAP://cn="& UserLOGID &",ou="& OrgUnit
&",ou=People,dc=internal,dc=business,dc=big,dc=com,dc=au")
objUser.IsAccountLocked = False
objUser.SetInfo
MsgBox ("Account has been unlocked" & vbOKOnly)
Wscript.Quit
*****SCRIPT END**************************
.
- Follow-Ups:
- Re: Script help please (unlock locked out accounts) NEWBIE question.
- From: Clubsprint
- Re: Script help please (unlock locked out accounts) NEWBIE question.
- References:
- Script help please (unlock locked out accounts) NEWBIE question.
- From: Clubsprint
- Script help please (unlock locked out accounts) NEWBIE question.
- Prev by Date: Script help please (unlock locked out accounts) NEWBIE question.
- Next by Date: Re: excuse my ignorance, but what is a "performance counter"?
- Previous by thread: Script help please (unlock locked out accounts) NEWBIE question.
- Next by thread: Re: Script help please (unlock locked out accounts) NEWBIE question.
- Index(es):
Relevant Pages
|