Functions/Users/Remove-UserFromTeam.ps1
function Remove-UserFromTeam { [CmdletBinding( SupportsShouldProcess, ConfirmImpact = 'Low' )] [OutputType([string])] param ( [Parameter( Mandatory, HelpMessage = 'The unique ID of the user' )] [string]$UserId, [Parameter( Mandatory, HelpMessage = 'The unique team ID.' )] [string]$TeamId ) begin { $url = "https://$($Script:ApiURL)/v2-edge/users/$UserId/teams/$TeamId" } process { $restCall = @{ 'Method' = 'Delete' 'ContentType' = $Script:ContentType 'Uri' = "$url" 'WebSession' = $Script:WebSession } if ($PSCmdlet.ShouldProcess("UserId: $UserId and TeamId: $TeamId", 'Removing Remote Access user to team')) { $result = Invoke-RestMethod @restCall } } end { Write-Output -InputObject $result } } |