microsoft / StigRepo

Automated PowerSTIG Repository for Active Directory environments
35 stars 6 forks source link

New-SystemData: If the environment has a single "Servers" OU, it will not create new system data for systems residing in the root Servers OU. (OU=Servers,DC=Domain,DC=Com). #19

Closed coaldric closed 3 years ago

coaldric commented 3 years ago

New-SystemData/ActiveDirectoryFunctions - Issue: If the environment has a single "Servers" OU, it will not create new system data for systems residing in the root Servers OU. (OU=Servers,DC=Domain,DC=Com). This is because: $targetMachineOus.add($targetMachine.distinguishedname.Replace("CN=$($targetMachine.name),OU=Servers,","")) will replace "CN=MemberServerName,OU=Servers,DC=Domain,DC=Com" with "DC=Domain,DC=Com" and since that end result is not an organizational unit, it'll fail when attempting to run get-adorganizationalunit on line 154. In most cases this won't be an issue because you can expect customers to not have a Servers OU housing all of their servers without sub OUs. However, the Servers OU should be added to the array as well as the suborgs. To find the OS version, we can use a WMI Query: (Get-WmiObject win32_operatingsystem).caption; But I guess it really depends on what the use case is. If your management box also happens to be a server in AD and you need to just test that one device, instead of using "local", use "Targeted" I really don't understand what this is doing. What does the OU structure look like if its CN=SErverName,OU=Servers,....,DC=Domain..?

JakeDean3631 commented 3 years ago

@wwellington2 - Did either of your PRs remediate this issue?

JakeDean3631 commented 3 years ago

Issue closed in version 1.4