Multiple domain search

Welcome Forums General PowerShell Q&A Multiple domain search

This topic contains 3 replies, has 3 voices, and was last updated by

1 year ago.

  • Author
  • #94633

    Points: 0
    Rank: Member

    How is it possible to search on multiple domains in Get-ADUser Query?
    I have 3 domains –,,

    		Get-ADUser -Identity $_.samaccountname -Properties *
  • #94639

    Points: 69
    Rank: Member

    Are the domains in the same Forrest ? If so you could probably do something like this :-

    $Domains = (Get-ADForest).domains

    ForEach ($Domain in $Domains) {

    $UserAccount= Get-ADUser -server $domain |
    select SamAccountName

    $Users += $UserAccount

    $Users| Export-CSV Users.csv -notypeinformation

    • #94642

      Points: 0
      Rank: Member

      Unfortunately they aren't in the same forest.

  • #94647

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Map a PSDrive to each domain using the AD provider. Change to each drive in turn and run your query.

The topic ‘Multiple domain search’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort