public/Remove-DuoUser.ps1
|
function Remove-DuoUser(){ [CmdletBinding()] param ( [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [string]$user_id ) [string]$method = "DELETE" [string]$path = "/admin/v1/users/$($user_id)" $APiParams = $MyInvocation.BoundParameters $apiparams.Remove('user_id') $DuoRequest = Convertto-DUORequest -DuoMethodPath $path -Method $method -ApiParams $ApiParams $Response = Invoke-RestMethod @DuoRequest -SkipHeaderValidation:$true If($Response.stat -ne 'OK'){ Write-Warning 'DUO REST Call Failed' Write-Warning ($APiParams | Out-String) Write-Warning "Method:$method Path:$path" } $Output = $Response | Select-Object -ExpandProperty Response $Output } |