Public/MIT/New-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
function New-MITUser
{
    [CmdletBinding()]
    param (
        [string]$SourceUserId,
        [string]$FullName,
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]$Username,
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]$Password,
        [string]$Email,
        [ValidateSet('TemporaryUser', 'User', 'FileAdmin', 'Admin', 'SysAdmin')]
        [string]$Permission,
        [bool]$ForceChangePassword,
        [int32]$OrgID,
        [string]$Notes,
        [string]$HomeFolderPath,
        [ValidateSet('AllowIfExists', 'DenyIfExists')]
        [string]$HomeFolderInUseOption
    )

    $body = BuildQueryFromPSBoundParameters($PSBoundParameters)
    $response = Invoke-MITRequest -Method 'Post' -Resource "users" -Body $body
    Write-MITOutput -Response $response -Typename "MIREST.MITUserSimple"
}