Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to search multiple domains from csv for user AD account

$
0
0

Hello,

I am trying to write a one-liner for my team to search multiple domains listed in a column with CSV file titled "Domain".  I am not sure if I should be using Import-Csv or Get-Content, but this is the command line I have come up with so far.  This command pulls the "identity" provided but on the default domain and not the domains listed in the CSV. 

Any Help would be greatly appreciated.

Get-Content "H:\posh\MetroDomains.csv" | foreach{Get-QADUser -Identity '<username>' -Credential $admincreds.<account> -Domain $_.Domain} | select name,NTAccountName


Viewing all articles
Browse latest Browse all 6937

Trending Articles