rsnellman
asked on
Need assistance in changing my current usernames in AD to lowercase
Hi, it has been awhile since I needed the expert's advice/assistance. Not sure what that means. LOL.
Anyways, I am needing to change all usernames (full names) of a particular OU to all lowercase for a database migration. I thought I read somewhere a long time ago about such a thing or technique to accomplish this.
Currently, I am running...
Server: Windows Server 2003 - Standard
Active Directory : LDAP
OU: contains about 3500+ accounts
The usernames first letter are capitalized and the rest lowercase. I am required to modify all these usernames to all lowercase.
Any ideas or links would be amazingly appreciated.
Thanks for your time.
Bob
Anyways, I am needing to change all usernames (full names) of a particular OU to all lowercase for a database migration. I thought I read somewhere a long time ago about such a thing or technique to accomplish this.
Currently, I am running...
Server: Windows Server 2003 - Standard
Active Directory : LDAP
OU: contains about 3500+ accounts
The usernames first letter are capitalized and the rest lowercase. I am required to modify all these usernames to all lowercase.
Any ideas or links would be amazingly appreciated.
Thanks for your time.
Bob
Hi,
You can use this below Powershell script to pull change the case of Firstname, Lastname and SAM account name to Lowercase.
It needs Active roles powersshell snap in to execute this script. You can download active roles cmdlet from
$users = Get-content C:\users.txt | Get-Qaduser | Select-Object FirstName,Lastname,SamAcco untName,Lo gonName
foreach ($user in $users)
{
[string]$Fname = $user.FirstName
$FName = $FName.ToLower()
[string]$Lname = $user.Lname
$Lname = $Lname.ToLower()
[string]$SamName = $user.$SamAccountName
$SamName = $SamName.ToLower()
get-Qaduser -identity $LogonName -Firstname $FName -Lastname $Lname -SamAccountName $SamName
}
Regards,
Krishna
You can use this below Powershell script to pull change the case of Firstname, Lastname and SAM account name to Lowercase.
It needs Active roles powersshell snap in to execute this script. You can download active roles cmdlet from
$users = Get-content C:\users.txt | Get-Qaduser | Select-Object FirstName,Lastname,SamAcco
foreach ($user in $users)
{
[string]$Fname = $user.FirstName
$FName = $FName.ToLower()
[string]$Lname = $user.Lname
$Lname = $Lname.ToLower()
[string]$SamName = $user.$SamAccountName
$SamName = $SamName.ToLower()
get-Qaduser -identity $LogonName -Firstname $FName -Lastname $Lname -SamAccountName $SamName
}
Regards,
Krishna
ASKER
OK, I will give this a try on a couple of test accounts and let you know the results.
Thanks again.
Bob
Thanks again.
Bob
Remember that my script does the samAccountName, not the Display Name, First Name, and Last Names that you have requested. Don't forget to change the script accordingly.
If you need assistance with that, I can do it for you.
Regards,
Rob.
If you need assistance with that, I can do it for you.
Regards,
Rob.
Oh, and for testing, in my code, you'll see i had this:
'If strNewName = "rsampson" Then
.....
'End If
If you want to uncomment those lines, you can specify a specific logon name to only run against.
Regards,
Rob.
'If strNewName = "rsampson" Then
.....
'End If
If you want to uncomment those lines, you can specify a specific logon name to only run against.
Regards,
Rob.
ASKER
Hi,...sorry it has been a while since getting back to you all. You know how the holidays are and then school starting back up and all that...time gets away from you.
Anyways, I am ready to try this. Now Rob this script is vbscript, correct? Remember I am far from a scripter and it looks sort of familar...so I would say it is, but want to make sure. Now the only part of the accounts I am concerned about is the Full Name and maybe the display name. The rest can stay the same as are now.
So, this script will do that for me?
Thanks again.
Bob
Anyways, I am ready to try this. Now Rob this script is vbscript, correct? Remember I am far from a scripter and it looks sort of familar...so I would say it is, but want to make sure. Now the only part of the accounts I am concerned about is the Full Name and maybe the display name. The rest can stay the same as are now.
So, this script will do that for me?
Thanks again.
Bob
My script is VBScript, yes, but it only lowercases the samAccountName at the moment....I'll change it to do the full name shortly.....
Rob.
Rob.
ASKER
OK, thanks. Yes, I need the fulname or aka cn to be lowercased. The rest, like First Name, Last Name can remain uppercased.
Thanks again.
Bob
Thanks again.
Bob
From what I can remember, CN is actually a different attribute to Display Name. You can change DisplayName fine, but to change the CN, you actually to "rename" the account. I'll test it out and let you know.
Rob.
Rob.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for everything.
Bob
Bob
If you need assistance changing it to modify only First Name, Last Name, and Display Names, I can help with that.
You can restrict it to a certain OU, by changing
FROM 'LDAP://" & strDNSDomain & "' WHERE
to
FROM 'LDAP://OU=Users,OU=Office
Regards,
Rob.
Open in new window