Basic script not returning coeerct info

Welcome Forums General PowerShell Q&A Basic script not returning coeerct info

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 7 months ago.

  • Author
  • #6278

    Topics: 1562
    Replies: 0
    Points: 0
    Rank: Member

    by Beefstew at 2013-02-15 07:05:10


    Could anyone tell me why this most basic scipt is only returning the "name" value and not the "proxyaddresses"?

    $strFilter = "(objectCategory=User)"

    $objDomain = New-Object System.DirectoryServices.DirectoryEntry

    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.PageSize = 1000
    $objSearcher.Filter = $strFilter
    $objSearcher.SearchScope = "Subtree"

    $colProplist = "name", "proxyAddresses"
    foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}

    $colResults = $objSearcher.FindAll()

    foreach ($objResult in $colResults)
    {$objItem = $objResult.Properties; $}

    by ArtB0514 at 2013-02-15 07:36:04

    Wouldn't it be easier to use the AD cmdlets from RSAT?
    $Proxy = Get-ADUser -Filter * -Properties proxyAddresses | Select Name,proxyAddresses

    or the equivalent in the Quest snap-in?
    $Proxy = Get-QADUser -SizeLimit 0 -IncludedProperties proxyAddresses | Select Name,proxyAddresses

    by Beefstew at 2013-02-15 08:13:53

    How would I filter on a particlar OU please?


    by Klaas at 2013-02-15 08:31:45

    $Proxy = Get-ADUser -SearchBase 'OU=yourOU,DC=yourcompany,DC=com' -Filter * -Properties proxyAddresses | Select Name,proxyAddresses

The topic ‘Basic script not returning coeerct info’ is closed to new replies.