Public/Storage/Get-VmsArchiveStorage.ps1
function Get-VmsArchiveStorage { <# .SYNOPSIS Gets the Storage objects representing the live recording storages on Milestone XProtect recording servers .PARAMETER RecordingServer Specifies the Recording Server object from which to return storage configurations .PARAMETER Name Specifies the name of the storage configuration to return. Supports wildcards. .PARAMETER ItemPath Specifies the Milestone Configuration API path for the storage configuration. For example, Storage[eef84b4a-1e7a-4f99-ac5f-671ae76d520b] Note: You may pipe a camera object to this cmdlet and the RecordingStorage alias will be used to identify the correct storage configuration .EXAMPLE PS C:\> Get-RecordingServer -Name 'Recorder 1' | Get-VmsStorage Gets all storage configurations on the recording server named 'Recorder 1 .EXAMPLE PS C:\> Get-RecordingServer | Get-VmsStorage -Name 'Local*' Gets all storage configurations on all recording servers where the name begins with 'Local' .EXAMPLE PS C:\> $camera | Get-VmsStorage Gets the storage configuration associated with the Camera object in the variable $camera #> [CmdletBinding()] [OutputType([VideoOS.Platform.ConfigurationItems.ArchiveStorage])] param ( [Parameter(Mandatory, ValueFromPipeline)] [VideoOS.Platform.ConfigurationItems.Storage] $Storage, [Parameter()] [ValidateNotNullOrEmpty()] [SupportsWildcards()] [string] $Name = '*' ) process { $storagesMatched = 0 $Storage.ArchiveStorageFolder.ArchiveStorages | ForEach-Object { if ($_.Name -like $Name) { $storagesMatched++ Write-Output $_ } } if ($storagesMatched -eq 0 -and -not [System.Management.Automation.WildcardPattern]::ContainsWildcardCharacters($Name)) { Write-Error "No recording storages found matching the name '$Name'" } } } |