functions/groups/Get-TssGroupAudit.ps1
|
function Get-TssGroupAudit { <# .SYNOPSIS Get the audit records for groups .DESCRIPTION Returns the administration audit records for groups, such as group renames and groups being enabled or disabled. Each record has the action, notes, date and the user who made the change. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssGroupAudit -TssSession $session Gets the group audit records .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/groups/Get-TssGroupAudit .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/groups/Get-TssGroupAudit.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Groups.Audit[]')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession ) begin { $tssParams = $PSBoundParameters $invokeParams = . $GetInvokeApiParams $TssSession } process { Get-TssInvocation $PSCmdlet.MyInvocation if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { Compare-TssVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation $uri = $TssSession.ApiUrl, 'groups', 'audit' -join '/' $queryParams = @() $queryParams += "take=$($TssSession.Take)" if ($queryParams) { $uri = $uri, ($queryParams -join '&') -join '?' } $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $uri" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning 'Issue with Get-TssGroupAudit request' $err = $_ . $ErrorHandling $err } if ($restResponse.records) { [Thycotic.PowerShell.Groups.Audit[]](. $FilterTssResponse $restResponse.records ([Thycotic.PowerShell.Groups.Audit])) } } else { Write-Warning 'No valid session found' } } } |