Public/MIT/Set-MITUser.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Set-MITUser
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]$Id,
        [ValidateSet('MOVEitOnly', 'ExternalOnly', 'Both')]
        [string]$AuthMethod,
        [int64]$DefaultFolderId,
        [string]$Email,
        [ValidateSet('HTML','Text')]
        [string]$EmailFormat,
        [bool]$ForceChangePassword,
        [string]$Language,
        [string]$Notes,
        [ValidateSet('ReceivesNoNotifications', 'ReceivesNotifications','AdminReceivesNotifications')]
        [string]$ReceivesNotification,
        [ValidateNotNullOrEmpty()]
        [string]$Password,
        [ValidateSet('TemporaryUser', 'User', 'FileAdmin', 'Admin', 'SysAdmin')]
        [string]$Permission,
        [int64]$FolderQuota,
        [string]$FullName,
        [ValidateSet('Active','Suspended','Template')]
        [string]$Status,
        [string]$StatusNote
    )

    #Need to exclude "Id" from the parameters used for the body
    $limitedParameters = $PSBoundParameters
    $limitedParameters.Remove('Id') | Out-Null
    $body = BuildQueryFromPSBoundParameters($limitedParameters)
    $response = Invoke-MITRequest -Method 'Patch' -Resource "users/$Id" -Body $body
    Write-MITOutput -Response $response -Typename "MIREST.MITUserSimple"
}