Active Directory Powershell Cmdlets in 2012 R2 ~ My blog about Active Directory and everything else

Tuesday, October 22, 2013

Active Directory Powershell Cmdlets in 2012 R2

Windows Server 2012 R2 was released on Oct 18, 2013.   Last Friday was a big day for everyone in the Microsoft community.   In future blog posts I'll be going over some of the new features available for Active Directory in 2012 R2.   I first want to get to know the features well before I blog about them :)

One area that most Active Directory admins are familiar with is PowerShell.   Not everyone is a PowerShell Expert but I'm seeing a lot of folks trying to learn PowerShell and this is definitely true in the Active Directory community.

Windows 2012 R2 and Windows 8.1 introduced PowerShell version 4.   This blog goes over the various versions of PowerShell and what is included for Active Directory in each version.

It is also important to know that you can run various versions of the AD cmdlets against DCs with the Active Directory Web Services running  Ashley McGlone aka GoateePFE has an excellent blog on how to use the PowerShell v 3.0 cmdlets from Windows 7.   I'd personally use a Windows 8 or 8.1 admin workstation if possible.

PowerShell was known by the Code Name "Monad" and first shown off publically in 2003.  It has come a long way since then.   In PowerShell version 1.0 there were no native Active Directory cmdlets.   Quest released PowerShell cmdlets that worked in version 1.  The Quest cmdlets are still used today and also work in versions 2-4.

Starting with PowerShell version 2 the Microsoft Active Directory team introduced a native AD module. The initial native AD module contains 76 cmdlets and deals with many common tasks that AD admins deal with including object manipulation (users, groups, computers).

For this blog I'm focusing on the ActiveDirectory module and not other modules such as ADDSDeployment, DNS, and GroupPolicy that are also heavily used by AD admins.

Getting the total number of AD cmdlets is a quick one liner:





The picture below is a snapshot of the different versions and what is included in each version.  If anyone wants the slide please let me know and I'll send you the PowerPoint.


Active Directory PowerShell Modules through the years



The 76 Active Directory cmdlets introduced in version 2.0 are listed below.  Jeffrey Snover is the inventor of PowerShell (Thanks!).  He often says his favorite cmdlet is Get-Help.  I  agree with that and find it very useful.  Linux types "man" also works.  I use the example switch the most but you can self discover and learn more about any of these cmdlets.  There is also a lot of great material on the web for learning PowerShell.  I recommend the Microsoft Virtual Academy courses on PowerShell.





ACTIVE DIRECTORY POWERSHELL CMDETS VERSION 276 TOTAL AD CMDLETS IN v2
Add-ADComputerServiceAccountNew-ADGroup
Add-ADDomainControllerPasswordReplicationPolicyNew-ADObject
Add-ADFineGrainedPasswordPolicySubjectNew-ADOrganizationalUnit
Add-ADGroupMemberNew-ADServiceAccount
Add-ADPrincipalGroupMembershipNew-ADUser
Clear-ADAccountExpirationRemove-ADComputer
Disable-ADAccountRemove-ADComputerServiceAccount
Disable-ADOptionalFeatureRemove-ADDomainControllerPasswordReplicationPolicy
Enable-ADAccountRemove-ADFineGrainedPasswordPolicy
Enable-ADOptionalFeatureRemove-ADFineGrainedPasswordPolicySubject
Get-ADAccountAuthorizationGroupRemove-ADGroup
Get-ADAccountResultantPasswordReplicationPolicyRemove-ADGroupMember
Get-ADComputerRemove-ADObject
Get-ADComputerServiceAccountRemove-ADOrganizationalUnit
Get-ADDefaultDomainPasswordPolicyRemove-ADPrincipalGroupMembership
Get-ADDomainRemove-ADServiceAccount
Get-ADDomainControllerRemove-ADUser
Get-ADDomainControllerPasswordReplicationPolicyRename-ADObject
Get-ADDomainControllerPasswordReplicationPolicyUsageReset-ADServiceAccountPassword
Get-ADFineGrainedPasswordPolicyRestore-ADObject
Get-ADFineGrainedPasswordPolicySubjectSearch-ADAccount
Get-ADForestSet-ADAccountControl
Get-ADGroupSet-ADAccountExpiration
Get-ADGroupMemberSet-ADAccountPassword
Get-ADObjectSet-ADComputer
Get-ADOptionalFeatureSet-ADDefaultDomainPasswordPolicy
Get-ADOrganizationalUnitSet-ADDomain
Get-ADPrincipalGroupMembershipSet-ADDomainMode
Get-ADRootDSESet-ADFineGrainedPasswordPolicy
Get-ADServiceAccountSet-ADForest
Get-ADUserSet-ADForestMode
Get-ADUserResultantPasswordPolicySet-ADGroup
Install-ADServiceAccountSet-ADObject
Move-ADDirectoryServerSet-ADOrganizationalUnit
Move-ADDirectoryServerOperationMasterRoleSet-ADServiceAccount
Move-ADObjectSet-ADUser
New-ADComputerUninstall-ADServiceAccount
New-ADFineGrainedPasswordPolicyUnlock-ADAccount




An additional 59 Active Directory cmdlets were introduce with version 3.0 bringing the total to 135.  As you would expect the new cmdlets in v3 are centered around the new features introduced for Active Directory in Windows Server 2012 such as Dynamic Access Control

There are also new cmdlets in v3 that can be used to for Replication and Topology Management   They are not a complete replacement for the powerful repadmin tool but they are another excellent resource for AD admins.




59 ADDITIONAL AD CMDLETS POWERASHELL VERSION 3.0 135 TOTAL AD CMDLETS IN v3
Add-ADCentralAccessPolicyMemberGet-ADResourcePropertyValueTypeRemove-ADReplicationSiteLinkBridge
Add-ADResourcePropertyListMemberGet-ADTrustRemove-ADReplicationSubnet
Clear-ADClaimTransformLinkNew-ADCentralAccessPolicyRemove-ADResourceProperty
Get-ADCentralAccessPolicyNew-ADCentralAccessRuleRemove-ADResourcePropertyList
Get-ADCentralAccessRuleNew-ADClaimTransformPolicyRemove-ADResourcePropertyListMember
Get-ADClaimTransformPolicyNew-ADClaimTypeSet-ADCentralAccessPolicy
Get-ADClaimTypeNew-ADDCCloneConfigFileSet-ADCentralAccessRule
Get-ADDCCloningExcludedApplicationListNew-ADReplicationSiteSet-ADClaimTransformLink
Get-ADReplicationAttributeMetadataNew-ADReplicationSiteLinkSet-ADClaimTransformPolicy
Get-ADReplicationConnectionNew-ADReplicationSiteLinkBridgeSet-ADClaimType
Get-ADReplicationFailureNew-ADReplicationSubnetSet-ADReplicationConnection
Get-ADReplicationPartnerMetadataNew-ADResourcePropertySet-ADReplicationSite
Get-ADReplicationQueueOperationNew-ADResourcePropertyListSet-ADReplicationSiteLink
Get-ADReplicationSiteRemove-ADCentralAccessPolicySet-ADReplicationSiteLinkBridge
Get-ADReplicationSiteLinkRemove-ADCentralAccessPolicyMemberSet-ADReplicationSubnet
Get-ADReplicationSiteLinkBridgeRemove-ADCentralAccessRuleSet-ADResourceProperty
Get-ADReplicationSubnetRemove-ADClaimTransformPolicySet-ADResourcePropertyList
Get-ADReplicationUpToDatenessVectorTableRemove-ADClaimTypeSync-ADObject
Get-ADResourcePropertyRemove-ADReplicationSiteTest-ADServiceAccount
Get-ADResourcePropertyListRemove-ADReplicationSiteLink


Windows Server 2012 R2 introduced an additional 12 AD cmdlets bringing the total up to 147 AD cmdlets. The 12 new cmdlets are centered around Authentication Policies and Authentication Policy Silos.   If you haven't seen them then open up the AD Admin Center on a 2012 R2 box




I'm personally still learning about these new features myself.   Authentication policies can control which hosts an account can sign into. Windows Server 2012 R2 is also being called the "CloudOS" so many of the new features are based around Azure and the cloud.


12 ADDITIONAL AD CMDLETSPOWERSHELL VERSION 4.0147 TOTAL AD CMDLETS IN v4
Get-ADAuthenticationPolicyNew-ADAuthenticationPolicySiloSet-ADAccountAuthenticationPolicySilo
Get-ADAuthenticationPolicySiloRemove-ADAuthenticationPolicySet-ADAuthenticationPolicy
Grant-ADAuthenticationPolicySiloAccessRemove-ADAuthenticationPolicySiloSet-ADAuthenticationPolicySilo
New-ADAuthenticationPolicyRevoke-ADAuthenticationPolicySiloAccessShow-ADAuthenticationPolicyExpression

2 comments:

  1. Great post Mike! I was working on an AD + PowerShell article and this gem popped up in my RSS.

    ReplyDelete
    Replies
    1. Thanks Joe. Enjoying your PS blogs too. I'm going to start doing a lot more blogs with PS as I've cut the bug :)

      Delete