Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Check duplicate SamAccountNames across multiple domains?

$
0
0

I have not managed to get my script working and i'm not sure why.  I have not been given any errors when i run this script using PowerGUI.  Please help as i am trying to get an output that identifies duplicate SamAccountNames across multiple domains. The code i am using is as follows:

#This script searches two domains for inputted samaccountnames

$SamAccountNames = Import-Csv -Path c:\temp\sam1.csv
$username = Read-Host "Enter your Domain Admin Account"

$cred = Get-Credential -Credential $username 

#connects to the two Burberry domains
$domains = @( 
Connect-QADService -Service abc.xxxx.com -Credential $cred
Connect-QADService -Service abc123.corp -Credential $cred)

#get attribute and export to csv
$domains | % {Get-QADUser -SamAccountName $SamAccountNames  -IncludedProperties displayname,domain,title -Connection $_} | Select-Object samaccountname, displayname, domain, title  | Export-Csv c:\temp\output.csv -NoTypeInformation




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>