ActiveDirectoryDsc icon indicating copy to clipboard operation
ActiveDirectoryDsc copied to clipboard

ADDomainController: Test method does not check all values

Open raandree opened this issue 7 years ago • 4 comments

Test-TargetResource has some issues.

  • It does not look for properties SysvolPath, LogPath and DatabasePath
  • It throws an exception if the site name is wrong instead of returning a bool
  1. Provided a non-existing path still returns true
Test-TargetResource -DomainName contoso.com -DomainAdministratorCredential $cred -SafemodeAdministratorPassword $cred -DatabasePath C:\WrongPath -SiteName Default-First-Site-Name
True
  1. Providing a non-existing site throws an exception and does not return a bool
Test-TargetResource -DomainName contoso.com -DomainAdministratorCredential $cred -SafemodeAdministratorPassword $cred -DatabasePath C:\WrongPath -SiteName WrongSite
Site 'WrongSite' could not be found.
At line:196 char:13
+             throw (New-Object -TypeName System.InvalidOperationExcept ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], InvalidOperationException
    + FullyQualifiedErrorId : Site 'WrongSite' could not be found.

raandree avatar Mar 07 '17 22:03 raandree

SysvolPath, LogPath and DatabasePath not being detected are valid points. But I'm not sure about wrong site name. If Test-TargetResource won't catch it you'll get an error later when Set-TargetResource kicks in for example.

gordonbondon avatar Jun 15 '17 15:06 gordonbondon

Can you move all of the paths after a machine has been promoted? If they cannot be moved easily, then I suggest we document this rather than try to implement it.

iainbrighton avatar Jun 15 '17 16:06 iainbrighton

Doesn't look particularly easy 😢

  • https://support.microsoft.com/en-us/help/842162/how-to-relocate-the-sysvol-tree-on-a-domain-controller-that-is-running-nt-file-replication-service-for-sysvol
  • https://technet.microsoft.com/en-us/library/cc816594%28v=ws.10%29.aspx

iainbrighton avatar Jun 15 '17 16:06 iainbrighton

I could see implementing a check to make sure the path is passed can be created if it doesn't exist. But as long as it is a valid path meaning the drive letter exists, then it will create those files in that location.

rchristman89 avatar Jan 16 '19 01:01 rchristman89