Saturday, May 24, 2025
HomePowershellAltering Energetic Listing Consumer Logon Names (Bulk) – SID-500.COM

Altering Energetic Listing Consumer Logon Names (Bulk) – SID-500.COM


PowerShell

Energetic Listing customers go online with their logon names and password. However what are the foundations for assigning usernames? g.surname? surname? gsurname? What are the naming conventions? This text seems for and modifies customers who don’t meet the naming conference.

Trying to find logon names that don’t match the naming conference

For the next it’s assumed that you just use a naming conference of g.surname for all newly created customers (Patrick Gruenauer = p.gruenauer). So, we’ve to seek for usernames that don’t have a dot (.). Right here’s one:

4.JPG

Now we’re on the lookout for customers in a selected Organizational Unit (Folks) that don’t meet the naming conference.

Examine the record fastidiously. Within the subsequent step we are going to begin modifying their SamAccountName and Userprincipalname.

Altering person logon names

Now we’re going to exchange the SamAccountName and the UserprincipalName with the primary letter of the givenname adopted by . and the lastname in decrease case.

# Change the logon identify of all customers within the HR OU to the primary letter of the primary identify and the final identify.
# For instance, John Doe: doe@area.com ==> j.doe@area.com

# Specify the OU the place the customers are situated
$OU = "OU=HR,DC=PAGR,DC=INET"
# Change the logon identify of all customers

Get-ADUser -Filter * -SearchBase $OU |
Foreach-Object {
    Set-ADUser $_ -SamAccountName ($_.givenname.substring(0,1) + '.' + $_.surname).tolower() `
    -UserPrincipalName (($_.givenname.substring(0,1) + '.' + $_.surname).tolower() + "@" + "$env:userdnsdomain") -Verbose
}

Schwarzenberg then turns into a.schwarzenberg:

3.JPG

Final however not least

Don’t neglect to tell the customers! 😉

Revealed by Patrick Gruenauer

Microsoft MVP on PowerShell [2018-2025], IT-Coach, IT-Guide, MCSE: Cloud Platform and Infrastructure, Cisco Licensed Academy Teacher.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments