public/Set-AppVentiXConfigShare.ps1

<#
    .SYNOPSIS
        Sets the path to the AppVentiX configuration share.
 
    .DESCRIPTION
        This function sets the path to the AppVentiX configuration share. It checks if the specified path exists and has access. If the path is valid and the AppVentiX license is valid, it sets the path as the configuration share.
 
    .PARAMETER ConfigShare
        Specifies the path to the AppVentiX configuration share.
 
    .EXAMPLE
        Set-AppVentiXConfigShare -ConfigShare "C:\AppVentiX\Config"
 
    .NOTES
        Function : Set-AppVentiXConfigShare
        Author : John Billekens
        Copyright: Copyright (c) AppVentiX
        Version : 1.0
#>

function Set-AppVentiXConfigShare {
    [CmdletBinding( SupportsShouldProcess, ConfirmImpact = 'Low')]
    Param(
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [String]$ConfigShare
    )
    if (Test-Path -Path $ConfigShare) {
        if ($PSCmdlet.ShouldProcess('Setting the ConfigShare as default during this session','','')) {
            if (Test-AppVentiXIsLicensed -ConfigShare $ConfigShare) {
                $Script:AppVentix.ConfigShare = $ConfigShare
            } else {
                Write-Warning "Could not configure the config share, AppVentiX license is not valid!"
            }
        }
    } else {
        Write-Warning "Config share '$ConfigShare' does not exist or no access!"
    }
}