Src/Private/Get-AbrOntapSecurityUsers.ps1
|
function Get-AbrOntapSecurityUser { <# .SYNOPSIS Used by As Built Report to retrieve NetApp ONTAP Security Local Users information from the Cluster Management Network .DESCRIPTION .NOTES Version: 0.6.12 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux .EXAMPLE .LINK #> param ( [Parameter ( Position = 0, Mandatory)] [string] $Vserver ) begin { Write-PScriboMessage 'Collecting ONTAP Security Local Users information.' } process { try { $Data = Get-NcUser -Vserver $Vserver -Controller $Array $OutObj = @() if ($Data) { foreach ($Item in $Data) { try { $inObj = [ordered] @{ 'User Name' = $Item.UserName 'Application' = $TextInfo.ToTitleCase($Item.Application) 'Auth Method' = $Item.AuthMethod 'Role Name' = $Item.RoleName 'Locked' = $Item.IsLocked } $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Security.Users) { $OutObj | Where-Object { $_.'Locked' -eq 'Yes' -and $_.'User Name' -ne 'vsadmin' } | Set-Style -Style Warning -Property 'Locked' } $TableParams = @{ Name = "Security Local Users - $($Vserver)" List = $false ColumnWidths = 25, 15, 15, 30, 15 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams if ($Healthcheck.Security.Users -and ($OutObj | Where-Object { $_.'Locked' -eq 'Yes' -and $_.'User Name' -ne 'vsadmin' })) { Paragraph 'Health Check:' -Bold -Underline BlankLine Paragraph { Text 'Best Practice:' -Bold Text 'Ensure that local users are not locked out to maintain proper access to the system. Review locked users and unlock them if necessary.' } BlankLine } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } end {} } |