Active Directory · PowerShell

Powershell and Active Directory: Get Your Active Directory Forest and Domain Information using Powershell.

Hi,

Sometime a situation comes when you want to know about your Active Directory Infrastructure.  That what is your AD Forest Name is, how many replica server do you have in your company,how many domain sites do you have  etc. etc.

When you get Answers you want to document all the above things for your future reference. Today a situation arise that i want to know answers about the above questions.

I know i can get all the answers by using Active Directory Module. But then i think if someone else need the same information, then what he will do?,he will do the same or he ask someone else in his team and waiting for their replies.

Then i think, why not to script it, so that everyone can get benefitted from it,.

So i write a simple script to done this task. Before running the script make sure you have RSAT tools installed.

Download Link : http://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-5a51444a

This script generates a HTML formatted Report file in your desktop folder.

That reports contain the information on :

  • Forest Name
  • Forest Mode
  • Forest Domains
  • Domain Naming Master
  • Schema Master
  • Global Catalog Servers
  • Forest Domain Sites
  • Domain Name
  • Domain NetBios Name
  • Domain Mode
  • PDC Emulator
  • InfraStructure Master
  • Replicated Servers

Screenshot of the script.

05-09-2012 15-40-18

Download Link : http://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-5a51444a

Thanks

Aman Dhally

join aman on facebook Join aman on Linkedin follow aman on Twitter

4 thoughts on “Powershell and Active Directory: Get Your Active Directory Forest and Domain Information using Powershell.

  1. HI, i have active directory server running on windows 2008 without R2 where the RSAT is not able to install in my server. therefore the script you written i’m not able to execuse.

    Any idea what should i do next?

  2. Hi,

    update:

    After i successfully execute the script, error prompt out on
    t C:\ad.ps1:26 char:16
    Import-Module <<<< -Name ActiveDirectory
    + CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

    he term 'Get-ADForest' is not recognized as the name of a cmdlet, function, script file, or operable program. Check th
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    t C:\ad.ps1:43 char:26
    $adFOREST = Get-ADForest <<<<
    + CategoryInfo : ObjectNotFound: (Get-ADForest:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    he term 'Get-ADDomain' is not recognized as the name of a cmdlet, function, script file, or operable program. Check th
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    t C:\ad.ps1:44 char:26
    $adDOMAIN = Get-ADDomain <<<<
    + CategoryInfo : ObjectNotFound: (Get-ADDomain:String) [], CommandNotFoundException

Comments are closed.