New Active Directory cmdlets available on Windows Server 2012

When I read the PowerTip: Use a PowerShell Cmdlet to Obtain AD DS Replication Information this week end, I gave it a try and noticed that there are new cmdlets available in the Powershell Active Directory module 😀

On a Windows 2008 R2 server, I got the total count of cmdlets in this Active Directory module:

ipmo ActiveDirectory            
(Get-Command -Module ActiveDirectory).Count            

On a Windows 2012 server I did the same, except that the module wasn’t listed as the RSAT feature wasn’t enabled. First, I needed to load the feature:

Add-WindowsFeature -Name RSAT-AD-PowerShell -Restart:$false

To be able to use the Add-WindowsFeature cmdlet on Windows 2008 R2, you also first need to load the Server Manager module like this:

ipmo ServerManager

It isn’t required on Windows 2012 because of the module preloading feature.

Now I’m able to inventory the total count of cmdlets in the Active Directory module for Powershell on Windows Server 2012 by invoking the same command:

(Get-Command -Module ActiveDirectory).Count            

Cool, huge difference. Then I wanted to get the list of these new cmdlets.
On the Windows 2008 R2 server, I prepared a preformatted console output that I would be able to paste on the Windows Server 2012 like this:

Get-Command -Module ActiveDirectory | % { '"{0}",' -f $_.Name }

I copied/pasted the result in the ISE console, added the first line to define an array and replaced the last comma (@line 77) by a closing paranthese (@line 78).

Here’s the full code that was in the ISE tab:

$W2008R2ADcmdlets = @(            
Get-Command -Module ActiveDirectory | % {            
    if ($_.Name -in $W2008R2ADcmdlets) {            
        # $true            
    } else {            
        # $false            
} | Sort-Object -Property Name            

Executing the above code gives the 59 new cmdlets available in Windows Server 2012 😎


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

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