SharePoint: TermStore and PowerShell

Consider the following TermStore as shown in the figure:

The following PowerShell code shows how to iterate through the above TermStore and find the term "Durban":
$siteCollectionUrl = "http://sp2010:90"
$site =new-object Microsoft.SharePoint.SPSite($siteCollectionUrl)
$session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
$termStore = $session.TermStores[0]
$group = $termStore.Groups["Corporate Taxonomy"]
$termSet = $group.TermSets["Geography"]
$terms = $termSet.GetAllTerms()
foreach ($term in $terms)
    if ($term.Name -eq "Durban")
        Write-Host "Drban Found!"
Here TermSet.GetAllTerms() returns a collection containing a flat list of all Term objects in the TermSet object.

profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts