title: How do I reverse transversal in a PowerShell array
body: <p>Given a PowerShell <s>array</s> hashtable<sup>1</sup>  similar to the following:</p>
  <pre><code>$dept= @{
       'Sales' = @{
          'SAM' = 'Manager'
          'SAP' = 'Person'
      }
      'IT' = @{
          'ITM' = 'Manager'
          'ITS' = 'Specialist'
          'ITT' = 'Technician'
          'ITC' = 'Consultant'     
      }
  }
  </code></pre>
  <p>If enter the following in the console:</p>
  <pre><code>$dept.it.itc
  $dept.sales.sam
  </code></pre>
  <p>I get:</p>
  <pre><code>Consultant
  Manager
  </code></pre>
  <p>Which is as expected.</p>
  <p>However, what I'd like to do is something like</p>
  <pre><code>write-host $dept.itc
  write-host $dept.sam
  
  </code></pre>
  <p>and get</p>
  <pre><code>IT Consultant
  Sales Manager
  </code></pre>
  <p>in return.</p>
  <p>I'm looking for a sort function to do a 'reverse traversal' of the array because 'IT', 'Sales' etc are the OU's I need to put new users into. There are many more OU's that I have removed for brevity.</p>
  <hr />
  <p><sup>[1]</sup> An <em>array</em> is simply a list of values and a <em>hashtable</em> is a collection of key/value pairs similiar to Javascript's JSON or Python's <code>dict</code>.</p>