Sortable HTML tables, local-time toggle, and RFC 3339 dates everywhere
- All timestamps (last logon, password last set, whenCreated, report generation time) now emit as RFC 3339 UTC in both the Markdown report and raw JSON dump, for both the Python and PowerShell scripts. - md_to_html.py: click any table header to sort ascending/descending (vanilla JS, numeric-aware); a "Show local time" toggle swaps every timestamp between UTC and the viewer's local offset, still RFC 3339.
This commit is contained in:
+13
-8
@@ -74,6 +74,11 @@ $UAC_DONT_REQ_PREAUTH = 0x400000
|
||||
$now = Get-Date
|
||||
$staleCutoff = $now.AddDays(-$StaleDays)
|
||||
|
||||
function ConvertTo-Rfc3339($DateTime) {
|
||||
if (-not $DateTime) { return $null }
|
||||
return $DateTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Object type counts (whole subtree)
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -92,7 +97,7 @@ $ous = Get-ADOrganizationalUnit -SearchBase $SearchBase -Filter * -Properties De
|
||||
DN = $_.DistinguishedName
|
||||
Name = $_.Name
|
||||
Description = $_.Description
|
||||
Created = $_.whenCreated
|
||||
Created = ConvertTo-Rfc3339 $_.whenCreated
|
||||
Depth = ([regex]::Matches($_.DistinguishedName, "OU=")).Count
|
||||
}
|
||||
}
|
||||
@@ -123,11 +128,11 @@ $users = Get-ADUser -SearchBase $SearchBase -Filter * -Properties $userProps @ad
|
||||
TrustedForDelegation = [bool]($uac -band $UAC_TRUSTED_FOR_DELEGATION)
|
||||
KerberosPreAuthDisabled = [bool]($uac -band $UAC_DONT_REQ_PREAUTH)
|
||||
AdminCount = [bool]($_.adminCount -gt 0)
|
||||
LastLogon = $lastLogon
|
||||
LastLogon = ConvertTo-Rfc3339 $lastLogon
|
||||
NeverLoggedOn = $neverLoggedOn -and $_.Enabled
|
||||
Stale = $stale
|
||||
PasswordLastSet = $_.PasswordLastSet
|
||||
Created = $_.whenCreated
|
||||
PasswordLastSet = ConvertTo-Rfc3339 $_.PasswordLastSet
|
||||
Created = ConvertTo-Rfc3339 $_.whenCreated
|
||||
GroupCount = (@($_.MemberOf)).Count
|
||||
}
|
||||
}
|
||||
@@ -148,9 +153,9 @@ $computers = Get-ADComputer -SearchBase $SearchBase -Filter * -Properties $compP
|
||||
OS = $_.OperatingSystem
|
||||
OSVersion = $_.OperatingSystemVersion
|
||||
Disabled = -not $_.Enabled
|
||||
LastLogon = $lastLogon
|
||||
LastLogon = ConvertTo-Rfc3339 $lastLogon
|
||||
Stale = $stale
|
||||
Created = $_.whenCreated
|
||||
Created = ConvertTo-Rfc3339 $_.whenCreated
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +174,7 @@ $groups = Get-ADGroup -SearchBase $SearchBase -Filter * -Properties Description,
|
||||
MemberCount = $memberCount
|
||||
Empty = ($memberCount -eq 0)
|
||||
Description = $_.Description
|
||||
Created = $_.whenCreated
|
||||
Created = ConvertTo-Rfc3339 $_.whenCreated
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +232,7 @@ Add-Line "# Active Directory Audit Report"
|
||||
Add-Line ""
|
||||
Add-Line "- Search base: ``$SearchBase``"
|
||||
if ($Server) { Add-Line "- Domain controller: ``$Server``" }
|
||||
Add-Line "- Generated: $($now.ToUniversalTime().ToString("o"))"
|
||||
Add-Line "- Generated: $(ConvertTo-Rfc3339 $now)"
|
||||
Add-Line "- Stale-account threshold: $StaleDays days of inactivity"
|
||||
Add-Line ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user