I'm trying to turn a short csv file into an hash table so I can use it for lookup in my script. It is not working, so I assume I don't understand something.
I have a two column csv with columns 'Supervisor' and 'Manager DN'. I tried to build a hash with the supervisor as the key and the ManagerDn as the value. To do so I tried this: (note: $ss has the contents of the csv imported using Import-csv)
$supdn=@()
$ss | foreach { $supdn[$_.Supervisor] = "$_.Manager DN"} When I do that, then try to retrieve the value of one of the keys using this:
$supdn["Baer,Bob P"]
I get this:
@{Supervisor=Baer,Bob P; Manager DN=CN=bbaer,OU=User Accounts,OU=Ourtown,DC=sometech,DC=com}.Manager DN
It appears the value of the key is itself a hash table.
I verified the contents of the $ss variable as this:
>
$ss
Supervisor Manager DN
---------- ----------
Abbey,David K. CN=Dabbey,OU=User Accounts,OU=OurTown,DC=Sometech,DC=com
Babu,Daniel M CN=Dxbabu,OU=User Accounts,OU=OurTown,DC=Sometech,DC=com
Ball,Sam A CN=Sball,OU=User Accounts,OU=OurTown,DC=Sometech,DC=com
Baer,Bob P CN=mbaer,OU=User Accounts,OU=OurTown,DC=Sometech,DC=com Can you help me understand what I'm missing?
Thanks
\\Greg