Skip to content

Commit 8d674b4

Browse files
committed
Working
1 parent 6218e91 commit 8d674b4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Active Directory/AD Users/Test-UsernameConventionMatch.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ function Test-UsernameConventionMatch {
2121
2222
.NOTES
2323
Requires the ActiveDirectory module.
24+
25+
TO DO: NEED TO HANDLE USERS THAT HAVE NO MIDDLE INITIAL BUT THE USERNAME IS STILL IN THE INITIALS FORMAT.
2426
#>
2527
[CmdletBinding()]
2628
param(
2729
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
2830
[Alias('SamAccountName', 'UserName', 'DistinguishedName')]
29-
[string[]]$Identity
31+
[string]$Identity
3032
)
3133

3234
begin {
@@ -45,7 +47,7 @@ function Test-UsernameConventionMatch {
4547
# Extract the necessary information
4648
$Username = $ADUser.SamAccountName
4749
$FirstName = $ADUser.GivenName
48-
$MiddleInitial = $ADUser.Initial
50+
$MiddleInitial = $ADUser.Initials
4951
$LastName = $ADUser.SurName
5052

5153
# Validate that we have first and last names

0 commit comments

Comments
 (0)