PowerShell Module with custom functions and cmdlets for Windows Active Directory.
This is a personal PowerShell Module by Claudio Spizzi. It is used to manage Windows Active Directory, e.g. testing the diagnostics (dcdiag) and replication (replsum) health or monitor the Active Directory changes.
-
Test-ADDomainControllerDiagnostic
Health test of Active Directory Domain Controllers by using the built-in and trusted "dcdiag.exe" command line tool. -
Test-ADDomainControllerReplication
Replication test of Active Directory Domain Controllers by using the build-in and trusted "repadmin.exe" command line tool.
-
Get-ADDirSyncChange
Use the DirSync function of Active Directory to monitor the changes. -
Get-ADUsnNumberUpdate
Uses the USN property of Active Directory to monitor the updates.
Use the following commands to test the health of the Domain Controllers and their replication.
# Test the Domain Controller health with dcdiag
Test-ADDomainControllerDiagnostic -ComputerName 'LON-DC1.contoso.com', 'LON-DC2.contoso.com'
# Test the Partition Replication health with repadmin
Test-ADDomainControllerReplication -ComputerName 'LON-DC1.contoso.com', 'LON-DC2.contoso.com'
With the following short script, the changes inside an Active Directory Domain can be monitored with the update sequence number (USN).
# Definition
$Partition = 'DC=adds,DC=contoso,DC=com'
$Server = 'DC21.adds.contoso.com'
$Filter = '*OU=Test,DC=adds,DC=contoso,DC=com'
$Cookie = 'usnnumberupdate.xml'
# Create Cookie File
Get-ADUsnNumberUpdate -Partition $Partition -ComputerName $Server -FilterWildcard $Filter -CookieFile $Cookie -Once
# Get Difference Since Cookie File
Get-ADUsnNumberUpdate -Partition $Partition -ComputerName $Server -FilterWildcard $Filter -CookieFile $Cookie -CookieReadOnly -Once |
Select-Object 'Timestamp', 'ObjectClass', 'ObjectGuid', 'ObjectSid', 'Identity', 'Account', 'Action', 'Field', 'Value' | Out-GridView
The DirSync API can be used to log detailed change information inside an Active Directory Domain.
# Definition
$Partition = 'DC=adds,DC=contoso,DC=com'
$Server = 'DC21.adds.contoso.com'
$Filter = '*OU=Test,DC=adds,DC=contoso,DC=com'
$Cookie = 'dirsyncchange.xml'
# Create Cookie File
Get-ADDirSyncChange -Partition $Partition -ComputerName $Server -FilterWildcard $Filter -CookieFile $Cookie -Once
# Get Difference Since Cookie File
Get-ADDirSyncChange -Partition $Partition -ComputerName $Server -FilterWildcard $Filter -CookieFile $Cookie -CookieReadOnly -Once |
Select-Object 'Timestamp', 'ObjectClass', 'ObjectGuid', 'ObjectSid', 'Identity', 'Account', 'Action', 'Field', 'Value' | Out-GridView
Please find all versions in the GitHub Releases section and the release notes in the CHANGELOG.md file.
Use the following command to install the module from the PowerShell Gallery, if the PackageManagement and PowerShellGet modules are available:
# Download and install the module
Install-Module -Name 'ActiveDirectoryFever'
Alternatively, download the latest release from GitHub and install the module manually on your local system:
- Download the latest release from GitHub as a ZIP file: GitHub Releases
- Extract the module and install it: Installing a PowerShell Module
The following minimum requirements are necessary to use this module, or in other words are used to test this module:
- Windows PowerShell 3.0
- Windows Server 2008 R2 / Windows 7
Please feel free to contribute by opening new issues or providing pull requests. For the best development experience, open this project as a folder in Visual Studio Code and ensure that the PowerShell extension is installed.
- Visual Studio Code with the PowerShell Extension
- Pester, PSScriptAnalyzer and psake PowerShell Modules