Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

How to ask a hash table inside a hash table

$
0
0

I have the following code which works but I would like to write to the output the users DN but I cannot work out how to access the imbedded hash table. Can any help me with this simply fix :)

$usersou = "ou=users,ou=company,dc=green,dc=sophos"
 $disabled_users = Search-ADAccount -AccountDisabled -UsersOnly -searchbase $usersou | select samaccountname,name,DistinguishedName|group-object -property samaccountname -ashashtable

foreach($user in $disabled_users.keys)
{
 write-output "Move user object $user to disabled OU"
 move-ADObject $user -targetpath $disabledou -whatif
}

Mike


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>