SecurityPolicyDsc icon indicating copy to clipboard operation
SecurityPolicyDsc copied to clipboard

Exception when No Administrator account

Open bobbytreed opened this issue 8 years ago • 3 comments

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.

bobbytreed avatar Dec 05 '17 14:12 bobbytreed

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 avatar Dec 05 '17 14:12 bobbytreed

@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.

jcwalker avatar Dec 15 '17 12:12 jcwalker

The issues description seems to be a bug, so labeling it as such. The other comment is being discussed in issue #78.

johlju avatar May 18 '18 08:05 johlju