Difference between revisions of "Get-ADForest"

From UVOO Tech Wiki
Jump to navigation Jump to search
 
Line 3: Line 3:
 
$AllDCs = Get-ADDomainController -Filter * -Server $DomainName | Select-Object Hostname,Ipv4address,isglobalcatalog,site,forest,operatingsystem
 
$AllDCs = Get-ADDomainController -Filter * -Server $DomainName | Select-Object Hostname,Ipv4address,isglobalcatalog,site,forest,operatingsystem
 
$AllDCs = (Get-ADForest).GlobalCatalogs
 
$AllDCs = (Get-ADForest).GlobalCatalogs
 +
foreach ($dc in $AllDCs){ invoke-command $dc -ScriptBlock {hostname} }
 
```
 
```

Latest revision as of 23:34, 10 June 2021

$DomainName = (Get-ADDomain).DNSRoot
$AllDCs = Get-ADDomainController -Filter * -Server $DomainName | Select-Object Hostname,Ipv4address,isglobalcatalog,site,forest,operatingsystem
$AllDCs = (Get-ADForest).GlobalCatalogs
foreach ($dc in $AllDCs){ invoke-command $dc -ScriptBlock {hostname} }