Public/Get-RiskSenseClient.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 50 51 52 53 |
function Get-RiskSenseClient { <# .SYNOPSIS List clients .DESCRIPTION List clients in RiskSense. Authority: Technician, User, Group Manager, Manager .EXAMPLE Get-RiskSenseClient #> [CmdletBinding()] param( # RiskSense API Key [Parameter(Mandatory)] $Token ) begin { $headers = Get-AuthHeader $Token } process { $result = Invoke-PaginatedRestMethod -Uri "$uri/client" -Headers $headers $result.clients.ForEach{ [PSCustomObject]@{ ID = $_.id UUID = $_.uuid Name = $_.name RS3 = $_.rs3 Contact = [PSCustomObject]@{ Address = $_.contact.address Address2 = $_.contact.address2 City = $_.contact.city State = $_.contact.state ZIP = $_.contact.zip Phone = $_.contact.phone } ExpirationDate = if ($_.expirationDate) {Get-Date $_.expirationDate} else {$null} Notes = $_.notes Description = $_.Description Industry = $_.industry Disabled = [System.Convert]::ToBoolean($_.disabled) DemoClient = [System.Convert]::ToBoolean($_.demoClient) AccountManagerId = $_.accountManagerId } } } end {} } |