Public/Set-ViewGroup.ps1
#Requires -Modules 'MilestonePSTools' function Set-ViewGroup { <# .SYNOPSIS Sets the properties of an existing View Group. .DESCRIPTION Working with View Groups is not currently supported in MIP SDK, however the redistributable SDK includes an assembly containing the VmoClient which is a component used internally by the SDK and applications like XProtect Management Client. This function makes use of this VmoClient to manipulate the View Groups to enable complex tasks required in some environments. .EXAMPLE PS C:\> Get-ViewGroup -Name 'Remote Guards' | Set-ViewGroup -Decription 'A new description' Gets the View Group(s) named 'Remote Guards' and sets the Description to 'A new description' .OUTPUTS The output of this function when called with the -PassThru switch will be a [VideoOS.Management.VmoClient.PublicViewGroup] object with the following properties: Parent : Views : {} PublicViewGroups : {} Name : Description : CreatedDate : 1/1/0001 12:00:00 AM LastModified : 1/1/0001 12:00:00 AM Id : 00000000-0000-0000-0000-000000000000 IsDirty : True IsCreated : False IsDeleted : False Exists : False CustomProperties : {} IsCustomPropertiesSupported : True ServerVersion : 20.3.1 } #> [CmdletBinding(ConfirmImpact='High', SupportsShouldProcess)] param( # Specifies the PublicViewGroup object to be updated [Parameter(Mandatory, ValueFromPipeline)] [ValidateNotNullOrEmpty()] [VideoOS.Management.VmoClient.PublicViewGroup] $ViewGroup, # Specifies the new name for the provided View Group [Parameter()] [ValidateNotNullOrEmpty()] [string] $Name, # Specifies the new description for the provided View Group [Parameter()] [ValidateNotNullOrEmpty()] [string] $Description, # Pass the updated viewgroup object to the pipeline [Parameter()] [switch] $PassThru ) begin { $vmo = Get-VmoClient } process { try { if ($PSCmdlet.MyInvocation.BoundParameters.ContainsKey('Name')) { $ViewGroup.Name = $Name } if ($PSCmdlet.MyInvocation.BoundParameters.ContainsKey('Description')) { $ViewGroup.Description = $Description } if ($PSCmdlet.ShouldProcess("Public View Group '$($ViewGroup.Name)'", 'Update')) { $ViewGroup.Update() } if ($PassThru) { Write-Output $ViewGroup } } catch { $vmo.Dispose() throw } } end { $vmo.Dispose() } } |