Skip to content

Instantly share code, notes, and snippets.

@rodmhgl
Created July 7, 2014 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodmhgl/cac3d84c2c918c81c1c1 to your computer and use it in GitHub Desktop.
Save rodmhgl/cac3d84c2c918c81c1c1 to your computer and use it in GitHub Desktop.
Add Object to HashTable
# 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