#requires -RunAsAdministrator # COMPUCARE IT | ACER MALL # 04 - Export AD inventory and basic diagnostics $ErrorActionPreference = 'Continue' Import-Module ActiveDirectory Import-Module GroupPolicy $ReportPath = 'C:\AcerMallAD\Reports' New-Item -ItemType Directory -Path $ReportPath -Force | Out-Null Get-ADDomain | Select-Object DNSRoot,NetBIOSName,DomainMode,PDCEmulator | Export-Csv "$ReportPath\Domain-Information.csv" -NoTypeInformation Get-ADDomainController -Filter * | Select-Object HostName,IPv4Address,Site,IsGlobalCatalog | Export-Csv "$ReportPath\Domain-Controllers.csv" -NoTypeInformation Get-ADOrganizationalUnit -Filter * | Select-Object Name,DistinguishedName | Export-Csv "$ReportPath\Organizational-Units.csv" -NoTypeInformation Get-ADUser -Filter * -Properties Enabled,Department,Title | Select-Object SamAccountName,Name,Enabled,Department,Title | Export-Csv "$ReportPath\User-Accounts.csv" -NoTypeInformation Get-GPO -All | Select-Object DisplayName,Id,GpoStatus,CreationTime,ModificationTime | Export-Csv "$ReportPath\Group-Policies.csv" -NoTypeInformation & dcdiag.exe /test:dns /v 2>&1 | Out-File "$ReportPath\DNS-Diagnostics.txt" & repadmin.exe /replsummary 2>&1 | Out-File "$ReportPath\Replication-Status.txt" Write-Host "Reports saved to $ReportPath" -ForegroundColor Green