Public/PageService/Update-CWCCustomProperty.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
function Update-CWCCustomProperty {
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory=$True)]
        [guid]$GUID,
        [Parameter(Mandatory=$True)]
        [int]$Property,
        [string]$Value,
        [string[]]$Group = 'All Machines'
    )

    $URI = "https://$($script:CWCServerConnection.Server)/Services/PageService.ashx/UpdateSessionCustomPropertyValue"

    $Body = ConvertTo-Json @($Group,$GUID,$Property,$Value)

    $WebRequestArguments = @{
        Uri = $URI
        Body = $Body
        Method = 'Post'
    }
    if ($PSCmdlet.ShouldProcess($WebRequestArguments.Body, "Update-CWCCustomProperty")) {
        Invoke-CWCWebRequest -Arguments $WebRequestArguments
    }
}