Skip to content

Get-GivenName using WMI returns the last name when using 'Last, First' formatting #3

@bbrownchg

Description

@bbrownchg

My organization uses 'Last, First' for our display names, so when the Get-GivenName function runs and has to retrieve the information from WMI the last name is returned instead of the first name. The specific command is on line 262:

$GivenName = $DisplayName.Split()[0].Trim()

I can easily remedy that by changing the split to 1:

$GivenName = $DisplayName.Split()[1].Trim()

Not sure if you want to document this somewhere, or find a way to account for differences in formatting between organizations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions