SecurityPolicyDsc
SecurityPolicyDsc copied to clipboard
Exception when No Administrator account
Apparently due to a back and forth debate over how ForEach processes $null, there is an issue when no local administrator group is returned.
The following code needs to be in an if statement like so.: if ($users -ne $null) { $accounts += $users | ForEach-Object {(Get-CimInstance win32_useraccount -Filter "Caption='$($_.Replace("", "\"))'").SID} }
I will fix this and submit a pull request.
Also, need guidance on how Translation exceptions should occur. Assume that the UserRights wants to assign a right to IIS APPPOOL\DefaultAppPool which might/might not exist depending on if IIS is activated. Should the code trigger an exception (current logic), or handle it quietly and return false.
@bobbytreed what is the issue exactly? Does the exception occur when there is no administrator account or administrators group?
And I agree there needs to be some discussion on how to handle translation exceptions. I'll open a separate issue to get the community's input.
The issues description seems to be a bug, so labeling it as such. The other comment is being discussed in issue #78.