Public/Get-ViewGroupData.ps1

#Requires -Modules 'MilestonePSTools'

function Get-ViewGroupData {
    <#
    .SYNOPSIS
        Gets the ViewGroupData from 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 retrieve a
        [VideoOS.Common.Proxy.Server.WCF.ViewGroupInternal] object by ID, and you can then manipulate the properties
        of the ViewGroupData before sending it back to the Management Server through Set-ViewGroupData.
    .EXAMPLE
        PS C:\> $data = $vg = Get-ViewGroup -Name 'Remote Guards' | Get-ViewGroupData
        Retrieve the contents or data for the View Group named 'Remote Guards'
    .INPUTS
        Takes a guid representing an existing View Group ID. You can get this from a call to Get-ViewGroup.
    #>

    [CmdletBinding()]
    param (
        [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [Guid]
        $Id
    )

    begin {
        $svc = Get-IServerCommandService
    }

    process {
        Write-Output ($svc.GetViewGroupData((Get-Token), $Id))
    }
}