PowerShell Export Sites and Subnets

Yapınızdaki tüm site ve subnetleri export edin;

$configNCDN = (Get-ADRootDSE).ConfigurationNamingContext

$siteContainerDN = (“CN=Sites,” + $configNCDN)

$siteObjs = Get-ADObject -SearchBase $siteContainerDN –filter { objectClass -eq
“site” } -properties “siteObjectBL”, name

foreach ($siteObj in $siteObjs) {

$subnetArray = New-Object -Type string[] -ArgumentList $siteObj.siteObjectBL.Count

$i = 0


foreach ($subnetDN in $siteObj.siteObjectBL) {

$subnetName = $subnetDN.SubString(3, $subnetDN.IndexOf(“,CN=Subnets,CN=Sites,”) – 3)

$subnetArray[$i] = $subnetName

$i++

}

$siteSubnetObj = New-Object PSCustomObject | Select SiteName, Subnets

$siteSubnetObj.SiteName = $siteObj.Name

$siteSubnetObj.Subnets = $subnetArray

$siteSubnetObj

}

Leave a Comment

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Solve : *
19 + 9 =