Category Archives: Active Directory

Windows 7 / Server 2008 R2 “Changing the Primary Domain DNS name of this computer to “” failed….”

Windows_Server_2008_R2_Logo

Windows Server 2008 R2 VMs started giving me errors while joining the domain recently, here is the exact error message that comes up:

Windows_7_Server_2008_R2_Changing_the_Primary_Domain_DNS_name_of_this_computer_to_failed_1

netsetup.log (%SystemRoot%\debug\netsetup.log) shows no errors and my VMs appears to be joined properly:

Windows_7_Server_2008_R2_Changing_the_Primary_Domain_DNS_name_of_this_computer_to_failed_2

Now to fix this there are two potential solutions/recommendations:
Continue reading

Domain Controller status is unavailable

Windows_Server_2008_R2_Logo

This problem was bugging me for a while now. Every time I have to connect to a different DC, status for one of them is showing as “Unavailable” In my case this hasn’t got anything to do with the domain controller actually functioning or having connectivity. DC works fine and I haven’t had any problems with it.

Few screenshots demonstrating the issue as well as explaining what’s the cause:

Domain_Controller_status_is_unavailable_1

Domain_Controller_status_is_unavailable_2

Continue reading

How to find out which Domain Controller my PC is talking to?

Windows_Server_2008_R2_Logo

One very useful piece of information to know, if you’re working in large Active Directory implementation with multiple DC’s and Sites, is to be able to determine which Domain Controller machines are authenticating against at any given time.

Here’s the command to tell us exactly that:

nltest /dsgetdc:domain_name

Rather handy if you’re testing whether Sites and Services have been setup correctly or are moving computer objects in Active Directory and want the quickest turnaround for GPO’s etc.

You could always use built-in ‘set l’ command but that’s not always accurate due to %logonserver% variable taking a bit of time to update if you change Active Directory site and ultimately domain controller you’re authentication against. Remote workers are good example as they tend to be all over the place and ‘set l’ might give misleading and not precise results.

Active Directory Script to Shutdown Computers per OU

Windows_Server_2008_R2_Logo

If you need to shutdown computers per OU in Active Directory here is one way of doing it:

The only change you have to make for this script to work is to provide an LDAP string/path to the OU in AD where you’d like to shut the PCs.

In my company we had to come up with a solution to comply with the “green” policy enforced upon us. Initially I have tried the built-in shutdown command and feeding in computer names using Excel and CONCATENATE function. Issue with that approach was that my script was trying to reach out to each machine to check if its on the network and pingable taking too long to complete. Script above doesn’t have the same issues – it literally fires up shutdown request simultaneously to all machines on the specified OU – much quicker and definitely more effective!

If you guys have other ideas or have other solutions please let me know in comments below!