Created
November 26, 2019 20:35
-
-
Save devynspencer/27df168d44866c36d3fd1af879013ac4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a list of users and computer names, add the SAM account name to each | |
@{ | |
Users = @( | |
@{ | |
Name = "Joe Joesworthy" | |
ComputerName = "P9XYZ123" | |
} | |
@{ | |
Name = "Seandog Millionaire" | |
ComputerName = "MJXYZ123" | |
} | |
) | |
} | |
$Users | select *, @{n="SamAccountName";e={$Name = $_.Name; (Get-ADUser -Filter { ANR -eq $Name }).SamAccountName.ToLower()}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment