Utilities/CCValidationUtility.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
using module "..\MCCA.psm1" <# This function returns list of parent labels and sublabels #> Function Get-RoleGroupwithMembers { Param( $RoleGroups, $LogFile, $Role ) $ConfigObjectList = @() try { $RoleGroupName = "" if ( $null -eq $RoleGroups) { $ConfigObject = [MCCACheckConfig]::new() $ConfigObject.ConfigItem = "$Role" $ConfigObject.ConfigData = "No Role Group with any Members" $ConfigObject.SetResult([MCCAConfigLevel]::Ok, "Fail") $ConfigObjectList += $ConfigObject } else { foreach ($RoleGroup in $RoleGroups ) { if ($RoleGroupName -ne "") { $RoleGroupName += ", $($RoleGroup.Name)" } else { $RoleGroupName = $($RoleGroup.Name) } } $ConfigObject = [MCCACheckConfig]::new() $ConfigObject.ConfigItem = "$Role" $ConfigObject.ConfigData = $($RoleGroupName) $ConfigObject.SetResult([MCCAConfigLevel]::Ok, "Pass") $ConfigObjectList += $ConfigObject } } catch { Write-Host "Error:$(Get-Date) There was an issue while running MCCA. Please try running the tool again after some time." -ForegroundColor:Red $ErrorMessage = $_.ToString() $StackTraceInfo = $_.ScriptStackTrace Write-Log -IsError -ErrorMessage $ErrorMessage -StackTraceInfo $StackTraceInfo -LogFile $LogFile -ErrorAction:SilentlyContinue } return $ConfigObjectList } |