Get-AllDomainControllers.ps1


Description

Purpose

Retrieves information about all domain controllers in the current domain.

Detailed Description

The Get-AllDomainControllers function retrieves information about all domain controllers in the current domain. It uses the Get-ADDomainController cmdlet to query the domain controllers and returns a custom object with the hostname, site, and operating system of each domain controller.

Back to Top

Usage

Example 1

Get-AllDomainControllers

This example retrieves information about all domain controllers in the current domain and displays the hostname, site, and operating system of each domain controller.

Back to Top

Notes

Author: Your Name Date: Current Date Version: 1.0

Back to Top


Script

<#
.SYNOPSIS
Retrieves information about all domain controllers in the current domain.

.DESCRIPTION
The Get-AllDomainControllers function retrieves information about all domain controllers in the current domain. It uses the Get-ADDomainController cmdlet to query the domain controllers and returns a custom object with the hostname, site, and operating system of each domain controller.

.PARAMETER None
This function does not accept any parameters.

.EXAMPLE
Get-AllDomainControllers

This example retrieves information about all domain controllers in the current domain and displays the hostname, site, and operating system of each domain controller.

.OUTPUTS
System.Management.Automation.PSCustomObject
The function returns a custom object with the following properties:
- Hostname: The hostname of the domain controller.
- Site: The site where the domain controller is located.
- OperatingSystem: The operating system running on the domain controller.

.NOTES
Author: Your Name
Date: Current Date
Version: 1.0
#>

Function Get-AllDomainControllers {
    Get-ADDomainController -Filter * -Server (Get-ADDomain).DNSRoot | Select-Object Hostname,Site,OperatingSystem
}

Back to Top

Download

Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.


Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.

Issue


Back to Top