Created
July 7, 2014 13:06
-
-
Save rodmhgl/cac3d84c2c918c81c1c1 to your computer and use it in GitHub Desktop.
Add Object to HashTable
This file contains 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
# Courtesy of /u/LordZillion from /r/PowerShell | |
$Users = Import-Csv -Path C:\Temp\AllTheUsers.csv | |
$HashTable = @{} | |
Foreach($User in $Users) { | |
[int]$HashTableReference = $User.ExternalID | |
$HashTable[$HashTableReference] += New-Object -TypeName PSObject -Property @{ | |
'UserName' = ($User.UserName); | |
'Password' = ($User.Password); | |
'Email' = ($User.Email); | |
'FirstName' = ($User.FirstName); | |
'LastName' = ($User.LastName); | |
'FullName' = ($User.FirstName +' '+ $User.LastName) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment