mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
commit
5fea2cf86d
1 changed files with 48 additions and 0 deletions
48
SnipeitPS/Public/Remove-User
Normal file
48
SnipeitPS/Public/Remove-User
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Removes User from Snipe-it asset system
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.PARAMETER ID
|
||||
Unique ID For User to be removed
|
||||
.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
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue