2020-12-14 11:53:02 +02:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Removes User from Snipe-it asset system
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
Long description
|
|
|
|
|
.PARAMETER ID
|
|
|
|
|
Unique ID For User to be removed
|
2021-05-19 15:51:49 +03:00
|
|
|
|
|
|
|
|
.PARAMETER url
|
|
|
|
|
URL of Snipeit system, can be set using Set-Info command
|
|
|
|
|
|
|
|
|
|
.PARAMETER apiKey
|
|
|
|
|
User's API Key for Snipeit, can be set using Set-Info command
|
|
|
|
|
|
2020-12-14 11:53:02 +02:00
|
|
|
.EXAMPLE
|
|
|
|
|
Remove-User -ID 44 -url $url -apiKey $secret -Verbose
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
function Remove-User ()
|
|
|
|
|
{
|
|
|
|
|
[CmdletBinding(
|
|
|
|
|
SupportsShouldProcess = $true,
|
|
|
|
|
ConfirmImpact = "Low"
|
|
|
|
|
)]
|
|
|
|
|
|
|
|
|
|
Param(
|
|
|
|
|
[parameter(mandatory = $true)]
|
|
|
|
|
[string]$ID,
|
|
|
|
|
[parameter(mandatory = $true)]
|
|
|
|
|
[string]$URL,
|
|
|
|
|
[parameter(mandatory = $true)]
|
|
|
|
|
[string]$APIKey
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$Values = @{
|
|
|
|
|
"ID" = $ID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$Body = $Values | ConvertTo-Json
|
|
|
|
|
|
|
|
|
|
$Parameters = @{
|
|
|
|
|
Uri = "$url/api/v1/users/$ID"
|
|
|
|
|
Method = 'Delete'
|
|
|
|
|
Body = $Body
|
|
|
|
|
Token = $apiKey
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
|
|
|
|
{
|
|
|
|
|
$result = Invoke-SnipeitMethod @Parameters
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result
|
|
|
|
|
}
|