Powershell

PowerShell to Find Name & OS Version of Domain Controllers

PowerShell to Find Name & OS Version of Domain Controllers

Previous week i received a request from SM to get the all domain controllers OS details as there are some of windows 2008 R1 domain controllers still existing in our environment and need to migrated to 2012 R2 .There are number of domain controllers in our environment or we can say around 1000 domain controllers in different locations across the world.

Below is the powershell script to get the domain controller name with OS details. it get the details from Domain Controllers OU and if you are aware about every objects in active directory contains the operating system information as below.

$list = (Get-ADForest).GlobalCatalogs
$domainnames = (Get-ADForest).Domains

$domainnames_arr = $domainnames| % {
$domname = $_
“$domname;” + (($_.split(“.”) | % {“DC=” + $_ }) -join “,” )
}

$DCarray=$domainnames_arr | % {
$myADobjects = New-Object System.Object
$dn = $_.split(“;”)[1]$dns = $_.split(“;”)[0]Get-ADComputer -SearchBase “OU=Domain Controllers,$dn” -server “$dns” -Properties OperatingSystem -filter * | `
select DNSHostName,name,@{l=”Domain”;e={$dns}},OperatingSystem, @{l=”OS Name”;e={((($_.OperatingSystem).split(” “)[0..2]) -join ” “)}}
}

$DCarray

So, that’s all in this blog. I will meet you soon with some other stuff. Have a nice day !!!

Recommended content

RODC Installation Guide- Step by step guide to install read only domain controller

RODC Filtered Attribute Set

Installing and configuring a RODC in Windows Server-2012

How to find the GUID of Domain Controller

Group Policy Understanding Group Policy Preferences

Group Policy Verification Tool GPOTool Exe

Group Policy Health Check on Specific Domain Controller

What is Netlogon Folder in Active Directory

How to Create Custom Attributes in Active Directory

How Can I Check the Tombstone Lifetime of My Active Directory Forest

How to Determine a Computers AD Site From the Command Line

How to Check the Active Directory Database Integrity

How to Check the Active Directory Database Integrity

Disabling and Enabling the Outbound Replication

DFS Replication Service Stopped Replication

What is Strict Replication Consistency

The replication operation failed because of a schema mismatch between the servers involved

Troubleshooting ad replication error 8418 the replication operation failed because of a schema mismatch between the servers

How to export replication information in txt file

Repadmin Replsummary

Enabling the outbound replication

Guys please don’t forget to like and share the post. You can also share the feedback on below windows techno email id.

If you have any questions feel free to contact us on admin@windowstechno.com also follow us on facebook@windowstechno to get updates about new blog posts.

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

Was this article helpful?
YesNo

Vipan Kumar

He is an Active Directory Engineer. He has been working in IT industry for more than 10 years. He is dedicated and enthusiastic information technology expert who always ready to resolve any technical problem. If you guys need any further help on subject matters, feel free to contact us on admin@windowstechno.com Please subscribe our Facebook page as well website for latest article. https://www.facebook.com/windowstechno

Leave a Reply

Back to top button