zjorz / Public-AD-Scripts

AD Scripts
GNU General Public License v3.0
268 stars 76 forks source link

Reset-KrbTgt-Password-For-RWDCs-And-RODCs.ps1: Script errors displayed #20

Open jnxxx opened 7 months ago

jnxxx commented 7 months ago

After upgrading to v3.4 I experienced some script errors just before listing the found DCs for the domain. I wasn't sure if significant or not, so I had to figure out what caused it.

It turned out the problem started in line 6933: $listOfRODCsInADDomain = $dcsInADDomain | Where-Object{$_."msDS-isRODC" -eq $true -Or $_.primaryGroupID -eq "521"} | ForEach-Object{$_.dnsHostName}

Besides some regular RODCs, it returned CN=AzureADKerberos,OU=Domain Controllers,... as member of the Read-only Domain Controllers group. However, it does not have a DNS name and it causes some problems in the following loop.

The temporary fix I made was just to change -or to -and.

zjorz commented 7 months ago

i will look into this and fix it in the next update of the script. ETA is currently unknown

thanks for the feedback