List DNS conditional forwarders Active Directory forest wide

With this simple script, you will be able to retrieve the DNS conditional forwarder settings in all the domain controllers in the forest. To get the list of the domain controllers in the Active Directory forest, the cmdlet get-adforest is used. I use the property GlobalCatalogs to get all the domain controller fqdn : in that case, all the domain controllers have to be global catalogs if you want a complete listing.

After that the cmdlet Get-WMIObject is used to retrieve the DNS conditional forwarder settings for each domain controller.

<>

Reference

Get-WMIObject (Technet)

SYNTAX
query (Default)

list

WQLQuery

class

path

DESCRIPTION

Starting in Windows PowerShell 3.0, this cmdlet has been superseded by Get-CimInstancehttp://technet.microsoft.com/library/jj590758(v=wps.630).aspx.

The Get-WmiObject cmdlet gets instances of Windows Management Instrumentation (WMI) classes or information about the available WMI classes. To specify a remote computer, use the ComputerName parameter. If the List parameter is specified, the cmdlet gets information about the WMI classes that are available in a specified namespace. If the Query parameter is specified, the cmdlet runs a WMI query language (WQL) statement.

This cmdlet does not use Windows PowerShell remoting to perform remote operations. You can use the ComputerName parameter of the Get-WmiObject cmdlet even if your computer does not meet the requirements for Windows PowerShellremoting or is not configured for remoting in Windows PowerShell.

Beginning in Windows PowerShell 3.0, the __Server property of the object that Get-WmiObject returns has a PSComputerName alias. This makes it easier to include the source computer name in output and reports.

EXAMPLES
Example 1: Get processes on the local computer

This command get the processes on the local computer.

Example 2: Gets services on a remote computer

This command gets the services on a remote computer. It uses the ComputerName parameter to specify the Internet Protocol (IP) address, 127.0.0.1. By default, the current account must be a member of the Administrators group on the remote computer.

Example 3: Get WMI classes in the root or default namespace of the local computer

This command gets the WMI classes in the root or default namespace of the local computer.

Example 4: Get a named service on multiple computers

This command gets the WinRM service on the computers that are specified by the value of the ComputerName parameter.

A pipeline operator (|) sends the output to the Format-List cmdlet, which adds the PSComputerName property to the default output. This makes it easy to see the computer on which the service resides.

PSComputerName is an alias of the __Server property of the objects that Get-WmiObject returns. This alias is introduced in Windows PowerShell 3.0.

Example 5: Stop a service on a remote computer

This command stops the WinRM service on the Server01 remote computer. The command uses a Get-WmiObject command to get the WinRM service on Server01. Then, it invokes the StopService method of the Win32_Service WMI class on the object that the Get-WmiObject command returns.

This command is an alternative to using the Stop-Service cmdlet.

Example 6: Get the BIOS on the local computer

This command gets the BIOS on the local computer. The command uses a value of all (*) for the Property parameter of the Format-List cmdlet to display all properties of the returned object in a list. By default, only a subset (defined in the Types.ps1xml configuration file) are displayed.

Example 7: Get the services on a remote computer

This command uses the Credential parameter of the Get-WmiObject cmdlet to get the services on a remote computer. The value of the Credential parameter is a user account name. The user is prompted for a password.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: