Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (([System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()).GetAllTrustRelationships() | ? TrustType -eq 'Forest' | % TrustedDomainInformation | % { [pscustomobject]@{DomainName=$_.DNSName;NetBIOSName=$_.NetBIOSName;DomainSID=$_.DomainSid}}) + (Get-ADDomain | % { [pscustomobject]@{DomainName=$_.DNSRoot;NetBIOSName=$_.NetBIOSName;DomainSID=$_.DomainSid}}) | Sort-Object -Property DomainName -Unique
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement