Import-Module ActiveDirectory
Write-Host "`n=== DOMAIN CONTROLLERS ===" -ForegroundColor Cyan
Get-ADDomainController -Filter * |
Select-Object HostName,IPv4Address,Site |
Format-Table -AutoSize
Write-Host "`n=== SEARCH USER IN AD ===" -ForegroundColor Cyan
Get-ADUser -LDAPFilter '(|(sAMAccountName=*Alchevskaya*)(userPrincipalName=*Alchevskaya*)(mail=alchevskayaalena@yandex.ru)(sn=*Алчевская*))' `
-Properties DisplayName,Mail,WhenCreated,Enabled |
Select-Object Name,SamAccountName,UserPrincipalName,Mail,Enabled,WhenCreated,DistinguishedName |
Format-List
Write-Host "`n=== USERNAME LENGTH ===" -ForegroundColor Cyan
$u = "Cheridnichenko-AlchevskayaA"
Write-Host "Username: $u"
Write-Host "Length: $($u.Length)"
Write-Host "Recommended AD sAMAccountName limit: 20"
Write-Host "`n=== AUDIT POLICY ===" -ForegroundColor Cyan
auditpol /get /category:*