-
-
Save irwins/519423b2ea64f127fb0bf9531127eee7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Author: I.C.A. Strachan | |
Version: | |
Version History: | |
Purpose: Create MD Report of saved AD Configuration | |
#> | |
[CmdletBinding()] | |
Param( | |
$snapshotDate= '29032016' | |
) | |
#Get ADSnapshot | |
$SavedADSnapshot = Import-Clixml .\export\dsa\ADReport-$($snapshotDate).xml | |
#MDReport Title | |
$MDReport = "# Active Directory snapshot report - $($snapshotDate)`n" | |
#region Get Forest Information | |
$ADForest = @" | |
# Forest Information | |
| | | | |
|---|---| | |
|Name | $($SavedADSnapshot.ForestInformation.Name) | | |
|RootDomain | $($SavedADSnapshot.ForestInformation.RootDomain) | | |
|ForestMode | $($SavedADSnapshot.ForestInformation.ForestMode.ToString()) | | |
|Domains | $($SavedADSnapshot.ForestInformation.Domains) | | |
"@ | |
$MDReport += $ADForest | |
#endregion | |
#region Domain Information | |
$ADDomain = @" | |
# Domain Information | |
| | | | |
|---|---| | |
|NetBIOSName | $($SavedADSnapshot.DomainInformation.NetBIOSName) | | |
|DomainMode | $($SavedADSnapshot.DomainInformation.DomainMode.ToString()) | | |
|DistinguishedName | $($SavedADSnapshot.DomainInformation.DistinguishedName) | | |
|DomainSID | $($SavedADSnapshot.DomainInformation.DomainSID) | | |
"@ | |
$MDReport += $ADDomain | |
#endregion | |
#region Default Password Policy | |
$ADPasswordPolicy = @" | |
# Default Password Policy | |
| | | | |
|---|---| | |
|ComplexityEnabled | $($SavedADSnapshot.DefaultPassWordPoLicy.ComplexityEnabled) | | |
|DistinguishedName | $($SavedADSnapshot.DefaultPassWordPoLicy.DistinguishedName) | | |
|LockoutDuration | $($SavedADSnapshot.DefaultPassWordPoLicy.LockoutDuration) | | |
|LockoutObservationWindow | $($SavedADSnapshot.DefaultPassWordPoLicy.LockoutObservationWindow) | | |
|LockoutThreshold | $($SavedADSnapshot.DefaultPassWordPoLicy.LockoutThreshold) | | |
|MaxPasswordAge | $($SavedADSnapshot.DefaultPassWordPoLicy.MaxPasswordAge) | | |
|MinPasswordAge | $($SavedADSnapshot.DefaultPassWordPoLicy.MinPasswordAge) | | |
|MinPasswordLength | $($SavedADSnapshot.DefaultPassWordPoLicy.MinPasswordLength) | | |
|PasswordHistoryCount | $($SavedADSnapshot.DefaultPassWordPoLicy.PasswordHistoryCount) | | |
|ReversibleEncryptionEnabled | $($SavedADSnapshot.DefaultPassWordPoLicy.ReversibleEncryptionEnabled) | | |
"@ | |
$MDReport += $ADPasswordPolicy | |
#endregion | |
#region FSMO Roles | |
$ADFSMORoles = @" | |
# FSMO Roles | |
| | | | |
|---|---| | |
|DomainNamingMaster| $($SavedADSnapshot.ForestInformation.DomainNamingMaster) | | |
|SchemaMaster | $($SavedADSnapshot.ForestInformation.SchemaMaster) | | |
|PDCEmulator | $($SavedADSnapshot.DomainInformation.PDCEmulator) | | |
|RIDMaster | $($SavedADSnapshot.DomainInformation.RIDMaster) | | |
|InfrastructureMaster | $($SavedADSnapshot.DomainInformation.InfrastructureMaster) | | |
"@ | |
$MDReport += $ADFSMORoles | |
#endregion | |
#region Global Catalogs | |
$ADGCs = @" | |
# Global Catalogs | |
|Global Catalogs | | |
|---| | |
$( | |
$SavedADSnapshot.ForestInformation.GlobalCatalogs | | |
ForEach-Object { | |
"|$_|`n" | |
} | |
) | |
"@ | |
$MDReport += $ADGCs | |
#endregion | |
#region Domain Controllers | |
$ADDCs = @" | |
# Domain Controllers | |
|Name|OperatingSystem|IPv4Address|Site| | |
|---|---|---|---| | |
$( | |
$SavedADSnapshot.DomainControllers | | |
ForEach-Object { | |
"|$($_.Name)|$($_.OperatingSystem)|$($_.IPv4Address)|$($_.Site)|`n" | |
} | |
) | |
"@ | |
$MDReport += $ADDCs | |
#endregion | |
#region Domain Administrators | |
$ADDomainAdmins = @" | |
# Domain Administrators | |
|Name|DistinguishedName| | |
|---|---| | |
$( | |
$SavedADSnapshot.DomainAdministrators | | |
ForEach-Object { | |
"|$($_.Name)|$($_.DistinguishedName)|`n" | |
} | |
) | |
"@ | |
$MDReport += $ADDomainAdmins | |
#endregion | |
#region Sites & Subnets | |
$ADSitesSubnets = @" | |
# Sites & Subnets | |
## Sites | |
|Name|Description|DistinguishedName| | |
|---|---|---| | |
$( | |
$SavedADSnapshot.Sites | | |
ForEach-Object { | |
"|$($_.Name)|$($_.Description)|$($_.DistinguishedName)|`n" | |
} | |
) | |
## Sitelinks | |
|Name|Cost|ReplicationFrequencyInMinutes | | |
|---|---|---| | |
$( | |
$SavedADSnapshot.SiteLinks | | |
ForEach-Object { | |
"|$($_.Name)|$($_.Cost)|$($_.ReplicationFrequencyInMinutes)|`n" | |
} | |
) | |
## Subnets | |
|Name|Site| | |
|---|---| | |
$( | |
$SavedADSnapshot.Subnets | | |
ForEach-Object { | |
"|$($_.Name)|$($_.Site)|`n" | |
} | |
) | |
"@ | |
$MDReport += $ADSitesSubnets | |
#endregion | |
#region Organizational Units | |
$ADOUs = @" | |
# Organizational Units | |
|Name|DistinguishedName| | |
|---|---| | |
$( | |
$SavedADSnapshot.OrganizationalUnits | | |
ForEach-Object { | |
"|$($_.Name)|$($_.DistinguishedName)|`n" | |
} | |
) | |
"@ | |
#$MDReport += $ADOUs | |
#endregion | |
#Save MDReport | |
$MDReport | Out-File ".\export\dsa\AD snapshot report - $($snapshotDate).md" -Encoding utf8 -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment