Update-QlikServiceCluster.ps1

function Update-QlikServiceCluster {
    <#
    .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
    Update-QlikServiceCluster 'abc'
 
    Description of the example.
 
    #>


    <# Enable -Confirm and -WhatIf. #>
    [CmdletBinding(SupportsShouldProcess = $true)]
    param(
    [parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelinebyPropertyName=$true,Position=0)]
    [Guid] $id,

    [string] $name,
    [int] $persistenceType,
    [int] $persistenceMode,
    [string] $rootFolder,
    [string] $appFolder,
    [string] $staticContentRootFolder,
    [string] $connector32RootFolder,
    [string] $connector64RootFolder,
    [string] $archivedLogsRootFolder
    )

    begin {
    }

    process {
    $cluster = Get-QlikServiceCluster $id -raw
    $sp = $cluster.settings.sharedPersistenceProperties

    if ($name) { $cluster.name = $name }
    if ($persistenceType) { $cluster.settings.persistenceType = $persistenceType }
    if ($persistenceMode) { $cluster.settings.persistenceMode = $persistenceMode }
    if ($rootFolder) { $sp.rootFolder = $rootFolder }
    if ($appFolder) { $sp.appFolder = $appFolder }
    if ($staticContentRootFolder) { $sp.staticContentRootFolder = $staticContentRootFolder }
    if ($connector32RootFolder) { $sp.connector32RootFolder = $connector32RootFolder }
    if ($connector64RootFolder) { $sp.connector64RootFolder = $connector64RootFolder }
    if ($archivedLogsRootFolder) { $sp.archivedLogsRootFolder = $archivedLogsRootFolder }

    $json = $cluster | ConvertTo-Json -Compress -Depth 10
    return Invoke-QlikPut /qrs/ServiceCluster/$id $json
  }

    end {
    }
}

if ($loadingModule) {
    Export-ModuleMember -Function 'Update-QlikServiceCluster'
}