0

I have two forests and I'd like to do a series of command on both of them. I have excactly the same username and password on both of the forests. I'm using

foreach ($forest in $forests) {
Connect-QADService -Service $forest -quiet
((all my commands go here!))
}

but I am only able to connect to the domain/forest I am currently in (this does not suprise me however..)

Is there a way that I can use the same username and password in both forests?

Sune
  • 3,080
  • 16
  • 53
  • 64

1 Answers1

0

Create a separate connection for each forest and use it as the value for the Connection parameter that is available on other QAD cmdlets.

PS> $pw = Read-Host "Enter password" -AsSecureString
PS> $forest1 = Connect-QADService -Service 'dc1.company1.com' -ConnectionAccount 'company1\administrator' -ConnectionPassword $pw
PS> $forest2 = Connect-QADService -Service 'dc2.company2.com' -ConnectionAccount 'company2\administrator' -ConnectionPassword $pw

PS> Get-QADUser -Connection $forest1

p.s There is no -quiet parameter.

Shay Levy
  • 121,444
  • 32
  • 184
  • 206
  • Thank you so much Shay!!! Shay to the rescue once again!! I thought -quiet suppresses warnings from -sizelimit.. Turns out that -warninaction does this. Once again, thank you!! – Sune Dec 31 '11 at 00:31