Public/Set-ViewGroupData.ps1

#Requires -Modules 'MilestonePSTools'

function Set-ViewGroupData {
    <#
    .SYNOPSIS
        Sets the ViewGroupData by submitting changes to the Management Server through the IServerCommandService interface
    .DESCRIPTION
        ViewGroupData contains a ViewGroupDataXml property which contains the definition for all views and groups
        within a Public View Group shared by one or more roles. This cmdlet will call SetViewGroupData on the
        IServerCommandService interface, updating the ViewGroupData with the contents of the object supplied to this cmdlet.
    .EXAMPLE
        PS C:\> $manuallyModifiedViewGroupData | Set-ViewGroupData
        Explanation of what the example does
    .INPUTS
        [VideoOS.Common.Proxy.Server.WCF.ViewGroupInternal] object obtained through a call to Get-ViewGroupData
    .NOTES
        General notes
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')]
    param (
        [Parameter(ValueFromPipeline)]
        [VideoOS.Common.Proxy.Server.WCF.ViewGroupInternal]
        $ViewGroupData
    )

    begin {
        $svc = Get-IServerCommandService
    }

    process {
        if ($PSCmdlet.ShouldProcess("Public View Group '$($ViewGroupData.ViewGroupInfo.Name)'", "Update")) {
            $svc.SetViewGroupData((Get-Token), $ViewGroupData.ViewGroupInfo.Id, $ViewGroupData.ViewGroupData)
        }
    }
}