Automated-AD-Setup icon indicating copy to clipboard operation
Automated-AD-Setup copied to clipboard

Fix XML import when only one site exists

Open CheckYourSix opened this issue 3 years ago • 0 comments

When only one site exists in ADSites.xml, it doesn't import as an array. This results in $FirstSite = $ADSites.ADSites.Site[0] being empty, which causes the script to skip over renaming Default-First-Site-Name and add the site specified in ADSites.xml as a separate site. The domain controller would have to be manually switched to the new site.

I switched to the SelectNodes function for importing and adjusted the appropriate variables. I've tested this with a single entry and multiple entries in ADSites.xml and it works without issue. I also changed the log message to more accurately reflect what it's doing.

CheckYourSix avatar Mar 27 '21 00:03 CheckYourSix