functions/Set-AdminUser.ps1
<#
.SYNOPSIS Updates existing user's administrator status .DESCRIPTION Updates a user's administrator level to true or false. .EXAMPLE Set-AdminUser 5 true Set-AdminUser 5 false #> Function Set-AdminUser { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string]$UserID, [Parameter(Mandatory=$true)] [string]$IsAdmin ) $uri = $CDXSERVER + "/x/admin/users/" + $UserID $JSON = ConvertTo-Json @{ isAdmin = $IsAdmin.ToLower() } $UpdateUser = Invoke-RestMethod -Uri $uri -Method Put -Body $JSON -Headers $headers -ContentType "application/json" Write-Verbose ( $UpdateUser | Format-Table | Out-String ) } |