Private/BuildConfigMemoryMap.ps1
function BuildConfigMemoryMap { [CmdletBinding()] [OutputType([hashtable])] param ( ) process { $stopWatch = [Diagnostics.StopWatch]::new() <# Collect Role information into a hashtable #> $stopWatch.Restart() $roles = @{} Write-Verbose "Collecting Role information" Get-Role | ForEach-Object { $roles.$($_.Name) = $_ } Write-Verbose "Completed Role information collection in $($stopWatch.Elapsed.TotalSeconds) seconds" <# Collect Smart Client Profile info #> $stopWatch.Restart() Write-Verbose "Collecting Smart Client Profile information" $vmo = Get-VmoClient $smartClientProfiles = @{} $vmo.ManagementServer.ClientProfileSection.SmartClientProfiles | Select-Object | Foreach-Object { $smartClientProfiles.$($_.Name) = $_ } $roleToSmartClientProfile = @{} foreach ($scProfile in $smartClientProfiles.Values) { foreach ($role in $scProfile.AttachedRoles.Name) { $roleToSmartClientProfile.$role = $scProfile.Name } } Write-Verbose "Completed Smart Client Profile information collection in $($stopWatch.Elapsed.TotalSeconds) seconds" <# Collect Management Client Profile info #> $stopWatch.Restart() Write-Verbose "Collecting Management Client Profile information" $mgmtClientProfiles = @{} $vmo.ManagementServer.ClientProfileSection.ManagementClientProfiles | Select-Object | ForEach-Object { $mgmtClientProfiles.$($_.Name) = $_ } $roleToMgmtClientProfile = @{} foreach ($mcProfile in $mgmtClientProfiles.Values) { foreach ($roleName in $mcProfile.AttachedRoles.Name) { $roleToMgmtClientProfile.$roleName = $mcProfile.Name } } Write-Verbose "Completed Management Client Profile information collection in $($stopWatch.Elapsed.TotalSeconds) seconds" <# Collect View Group info #> $stopWatch.Restart() Write-Verbose "Collecting Public View Group information" $viewGroups = @{} $vmo.ManagementServer.PublicViewGroups | Select-Object | Foreach-Object { $viewGroups.$($_.Name) = $_ } $noViewGroupPermissions = [VideoOS.Management.VmoClient.PublicViewGroupPermissionSet]::new() $allViewGroupPermissions = [VideoOS.Management.VmoClient.PublicViewGroupPermissionSet]::new() foreach ($key in [VideoOS.Management.VmoClient.PublicViewGroupPermissionSet]::SupportedPermissions($vmo.ServerConnection.ServerVersion) | Get-Member -MemberType Property | Select-Object -ExpandProperty Name) { if ($key -eq 'Edit') { $key = "Write" } $allViewGroupPermissions += [VideoOS.Management.VmoClient.PublicViewGroupPermission]::$key } Write-Verbose "Completed Public View Group information collection in $($stopWatch.Elapsed.TotalSeconds) seconds" @{ Roles = $roles SmartClientProfiles = $smartClientProfiles RoleToSmartClientProfile = $roleToSmartClientProfile ManagementClientProfiles = $mgmtClientProfiles RoleToManagementClientProfile = $roleToMgmtClientProfile ViewGroups = $viewGroups EmptyViewGroupPermissionSet = $noViewGroupPermissions FullViewGroupPermissionSet = $allViewGroupPermissions VmoClient = $vmo } } } |