It's working perfectly for standard media pool but for GFS there is not property called capacity or freespace and I don't have any result.
I don't find with Get-member something to get it.
For some reason these properties are not implemented for GFS media pools (standard and gfs media pools are of distinct classes).
Nonetheless, here is the workaround with .NET method:
Thank you for your answer.
I'm sorry but I don't know how to work with .NET .
I would like to use it with custom object but I don't know how to integrate it. This is my "bad" try
<#
Location : Inventory -> Tape Infrastructure -> Media Pools
Name : Media Pool name
Description : Media pool description
LibraryName : Library name
Capacity(TB) : Media Pool capacity
FreeSpace(TB) : Media Pool free space
RetentionType : Media Pool retention type
RetentionValue : Media Pool retention value
ParallelProcessing : Parallel processing state
N/A : Not enabled
1/2/3/... Parallel processing number
TaskParalleling : Parallel processing of backup chains within a single tape job state
True : Parallel processing of backup chains within a single tape job is enabled
False : Parallel processing of backup chains within a single tape job is not enabled
Worm : status worm on media pool
true : worm is enabled
false : worm is disabled
Encryption : Encryption state
True : Encryption is enabled
False : Encryption is not enabled
#>
function Get-VeeamStandardTapeMediaPool
{
Write-Output "Veeam Tape Media Pools"
$VeeamTapeMediaPool = Get-VBRTapeMediaPool
foreach ($element in $VeeamTapeMediaPool)
{
if ( $element.Type -ne "Gfs") {
if($element.MultiStreamingOptions.Enabled)
{
$ParallelProcessing=$element.MultiStreamingOptions.NumberOfStreams
if($element.MultiStreamingOptions.SplitJobFilesBetweenDrives)
{
$TaskParalleling = $true
}
else
{
$TaskParalleling = $false
}
}
else
{
$ParallelProcessing = $false
$TaskParalleling = $false
}
[pscustomobject]@{
Name = $element.Name
Description = $element.Description
LibraryName = (Get-VBRTapeLibrary | Where-Object {$_.id -eq $element.libraryid}).name
'Capacity (TB)' = $element.capacity / 1TB -as [int]
'FreeSpace (TB)' = $element.FreeSpace / 1TB -as [int]
MediaSetName = $element.MediaSetName
RetentionType = $element.RetentionPolicy.type
RetentionValue = [string] $element.RetentionPolicy.value + " " + $element.RetentionPolicy.period
ParallelProcessing = $ParallelProcessing
TaskParalleling = $TaskParalleling
WORM = $element.Worm
Encryption = $element.EncryptionOptions.Enabled
}
}
}
Write-Output "-------------------"
}
<#
Location : Inventory -> Tape Infrastructure -> Media Pools
Name : Media Pool name
Description : Media pool description
LibraryName : Library name
'Capacity(TB)' : Media Pool capacity
'FreeSpace(TB)' : Media Pool free space
DailyMediaSet : Daily media set name
DailyRetention : Daily media set retention
WeeklyMediaSet : Weekly media set name
WeeklyRetention : Weekly media set name
MonthlyMediaSet : Monthly media set name
MonthlyRetention : Monthly media set name
QuarterlyMediaSet : Quarterly media set name
QuarterlyRetention : Quarterly media set name
YearlyMediaSet : Yearly media set name
YearlyRetention : Yearly media set name
ParallelProcessing : Parallel processing state
N/A : Not enabled
1/2/3/... Parallel processing number
TaskParalleling : Parallel processing of backup chains within a single tape job state
True : Parallel processing of backup chains within a single tape job is enabled
False : Parallel processing of backup chains within a single tape job is not enabled
Worm : status worm on media pool
true : worm is enabled
false : worm is disabled
Encryption : Encryption state
True : Encryption is enabled
False : Encryption is not enabled
#>
function Get-VeeamGFSTapeMediaPool
{
Write-Output "Veeam GFS Tape Media Pools"
$VeeamGFSTapeMediaPool = [Veeam.Tape.Core.CTapeMediaPool]::GetUserGfsMediaPools()
foreach ($element in $VeeamGFSTapeMediaPool)
{
$DailyRetention = if ($element.Options.GfsDailyOptions.Enabled)
{
[string] $element.Options.GfsDailyOptions.RetentionPeriod.value + " " + $element.Options.GfsDailyOptions.RetentionPeriod.Type
}
else
{
"<N/A>"
}
$WeeklyRetention = if ($element.Options.GfsWeeklyOptions.Enabled)
{
[string] $element.Options.GfsWeeklyOptions.RetentionPeriod.value + " " + $element.Options.GfsWeeklyOptions.RetentionPeriod.Type
}
else
{
"<N/A>"
}
$MonthlyRetention = if ($element.Options.GfsMonthlyOptions.Enabled)
{
[string] $element.Options.GfsMonthlyOptions.RetentionPeriod.value + " " + $element.Options.GfsMonthlyOptions.RetentionPeriod.Type
}
else
{
"<N/A>"
}
$QuarterlyRetention = if ($element.Options.GfsQuarterlyOptions.Enabled)
{
[string] $element.Options.GfsQuarterlyOptions.RetentionPeriod.value + " " + $element.Options.GfsQuarterlyOptions.RetentionPeriod.Type
}
else
{
"<N/A>"
}
$YearlyRetention = if ($element.Options.GfsYearlyOptions.Enabled)
{
[string] $element.Options.GfsYearlyOptions.RetentionPeriod.value + " " + $element.Options.GfsYearlyOptions.RetentionPeriod.Type
}
else
{
"<N/A>"
}
if ($element.Options.ParallelProcessingOptions.Enabled)
{
$ParallelProcessing=$element.Options.ParallelProcessingOptions.DrivesCountToUse
if ($element.Options.ParallelProcessingOptions.TaskParalleling)
{
$TaskParalleling = $true
}
else
{
$TaskParalleling = $false
}
}
else
{
$ParallelProcessing = $false
$TaskParalleling = $false
}
[pscustomobject]@{
Name = $element.Name
Description = $element.Description
LibraryName = $element.HighestPriorityLibrary.Name
'Capacity (TB)' = $element.capacityString
'FreeSpace (TB)' = $element.FreeString
DailyMediaSet = $element.Options.GfsDailyOptions.MediaSetName
DailyRetention = $DailyRetention
WeeklyMediaSet = $element.Options.GfsWeeklyOptions.MediaSetName
WeeklyRetention = $WeeklyRetention
MonthlyMediaSet = $element.Options.GfsMonthlyOptions.MediaSetName
MonthlyRetention = $MonthlyRetention
QuarterlyMediaSet = $element.Options.GfsQuarterlyOptions.MediaSetName
QuarterlyRetention = $QuarterlyRetention
YearlyMediaSet = $element.Options.GfsYearlyOptions.MediaSetName
YearlyRetention = $YearlyRetention
ParallelProcessing = $ParallelProcessing
TaskParalleling = $TaskParalleling
[b] WORM = if ($element.TapeType -eq "WORM tape") {$true} else {$false} [/b]
Encryption = $element.IsEncryptionEnabled
}
}
Write-Output "-------------------"
}
I'm not sure if I choose the good method to identify worm type or not.
But in fact you even wrote more than you need to, that is, you don't need to define an else there for $false; it's implied if the condition isn't true.
Not like what you did is wrong, but can save some typing, and I think it makes it a bit more legible. Of course if you need another action for if $false, then define it in an else statement.
David Domask | Product Management: Principal Analyst