PowerShell: Connecting to a specific DC

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: , , , , , , ,

3 Responses to “PowerShell: Connecting to a specific DC”


  1. 1 ilya November 15, 2011 at 8:52 am

    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….

  2. 2 jj January 14, 2014 at 11:12 am

    i have connected by the same but even though changes happening by local site DC not internet site DC.


  1. 1 Connect-Service for Exchange cmdlets? « Dmitry’s PowerBlog: PowerShell and beyond Trackback on September 12, 2008 at 3:43 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

June 2007
M T W T F S S
« May   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  

%d bloggers like this: