This is a question which comes from time to time: how do you make the AD cmdlets work against a particular Domain Controller?
As you probably know you don’t actually need to explicitly connect to a DC to run the cmdlets. If you need a list of users in your domain you just install the cmdlets and run Get-QADUser
. This PowerShell cmdlet just runs against the closest DC of the current domain and retrieves the data.
However, what happens if your workstation is not a part of the domain? Or if you are managing a multi-domain/multi-forest environment and want to connect to a different domain than the one in which you are?
In that case the Connect-QADService
cmdlet comes really handy. You just run:
Connect-QADService -service 'server.company.com'
And you are connected to that specific domain controller for all subsequent cmdets.
Tags: oneliner, AD cmdlets, cmdlets, one-liner, PowerShell, AD, Active Directory, Examples
but sometimes you need to connect to specific dc (for example in company with offices in others city and a policy of replications for a quarter of hour) so that yours change to ad will applied immediately….
i have connected by the same but even though changes happening by local site DC not internet site DC.