New-QlikUserDirectory.ps1

function New-QlikUserDirectory {
    <#
    .SYNOPSIS
    This function ...
 
    .DESCRIPTION
    A bit more description
 
    .PARAMETER FromPipeline
    Shows how to process input from the pipeline, remaining parameters or by named parameter.
 
    .EXAMPLE
    New-QlikUserDirectory 'abc'
 
    Description of the example.
 
    #>


    <# Enable -Confirm and -WhatIf. #>
    [CmdletBinding(SupportsShouldProcess = $true)]
    param(
    [parameter(Mandatory=$false,Position=0)]
    [string]$name,

    [parameter(Mandatory=$false,Position=1)]
    [string]$userDirectoryName,

    [ValidateSet('Repository.UserDirectoryConnectors.ODBC.OdbcSql')]
    [string]$type,

    [string]$configured=$false,
    [string]$syncOnlyLoggedInUsers=$true,
    [string]$syncStatus=0,
    [string]$configuredError="",
    [string]$operationalError="",
    [System.Object[]]$settings = @()
    )

    begin {
    }

    process {

    $json = (@{
      name=$name;
      userDirectoryName=$userDirectoryName;
      configured=$configured;
      operational=$false;
      type=$type;
      syncOnlyLoggedInUsers=$syncOnlyLoggedInUsers;
      syncStatus=$syncStatus;
      configuredError=$configuredError;
      operationalError=$operationalError;
      settings=$settings
    } | ConvertTo-Json -Compress -Depth 10)

    return Invoke-QlikPost "/qrs/UserDirectory" $json
  }

    end {
    }
}

if ($loadingModule) {
    Export-ModuleMember -Function 'New-QlikUserDirectory'
}