Public/Monitoring/Get-SecureSphereReleasedSources.ps1
function Get-SecureSphereReleasedSources { # .ExternalHelp ..\..\..\..\SecureSpherePS-help.xml [CmdletBinding()] param ( [Parameter(Mandatory = $false, ValueFromPipeline, ValueFromPipelineByPropertyName)] [ValidateNotNullOrEmpty()] [UInt32] $Hours ) Begin { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" if ($null -eq $SecureSphereSession) { Write-Error "Please login to SecureSphere first. Use Set-SecureSphereServer and New-SecureSphereSession cmdlets." break } $ApiUrl = "$SecureSphereHost/SecureSphere/api/v1/monitor/blockedSources/recentlyReleased" if ($PSBoundParameters.ContainsKey('Hours')) { $ApiUrl = "$SecureSphereHost/SecureSphere/api/v1/monitor/blockedSources/recentlyReleased/$Hours" } } Process { Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)" Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)" try { $Result = Invoke-RestMethod -Method Get -Uri $ApiUrl -ContentType "application/json" -WebSession $SecureSphereSession } catch { Write-Error "$_" } return $Result } End { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete" } } |