-
- Novice
- Posts: 4
- Liked: never
- Joined: Feb 20, 2012 11:00 am
- Full Name: Tommaso Cecchi
- Contact:
Repository size
Hello, we are using V6 (w/ patch 3) and we are trying to understand how to extract information about how much free space in repositories is left.
We are using Windows repositories and we tried with:
get-vbrbackuprepository
but for how deep we may drill down the tree of methods and properties we have not seen a way to extract this info.
Can anyone give us some hint?
Thanks so much,
Tommaso
We are using Windows repositories and we tried with:
get-vbrbackuprepository
but for how deep we may drill down the tree of methods and properties we have not seen a way to extract this info.
Can anyone give us some hint?
Thanks so much,
Tommaso
-
- Veteran
- Posts: 293
- Liked: 19 times
- Joined: Apr 13, 2011 12:45 pm
- Full Name: Thomas McConnell
- Contact:
Re: Repository size
This is the cmdlet I use for the vPC Army Report that you can't tweak to your needs
Usage:
Sample Output:
Code: Select all
function Get-vPCRepoInfo {
[CmdletBinding()]
param (
[Parameter(Position=0, ValueFromPipeline=$true)]
[PSObject[]]$Repository
)
Begin {
$outputAry = @()
[Reflection.Assembly]::LoadFile("C:\Program Files\Veeam\Backup and Replication\Veeam.Backup.Common.dll") | Out-Null
function Build-Object {param($name, $path, $free, $total)
$repoObj = New-Object -TypeName PSObject -Property @{
Target = $name
storepath = $path
StorageFree = [Math]::Round([Decimal]$free/1GB,2)
StorageTotal = [Math]::Round([Decimal]$total/1GB,2)
FreePercentage = [Math]::Round(($free/$total)*100)
}
return $repoObj
}
}
Process {
foreach ($r in $Repository) {
if ($r.GetType().Name -eq [String]) {
$r = Get-VBRBackupRepository -Name $r
}
if ($r.Type -eq "WinLocal") {
$Server = $r.GetHost()
$FileCommander = [Veeam.Backup.Core.CRemoteWinFileCommander]::Create($Server.Info)
$storage = $FileCommander.GetDrives([ref]$null) | ?{$_.Name -eq $r.Path.Substring(0,3)}
$outputObj = Build-Object $r.Name $r.Path $storage.FreeSpace $storage.TotalSpace
}
elseif ($r.Type -eq "LinuxLocal") {
$Server = $r.GetHost()
$FileCommander = new-object Veeam.Backup.Core.CSshFileCommander $server.info
$storage = $FileCommander.FindDirInfo($r.Path)
$outputObj = Build-Object $r.Name $r.Path $storage.FreeSpace $storage.TotalSize
}
elseif ($r.Type -eq "CifsShare") {
$fso = New-Object -Com Scripting.FileSystemObject
$storage = $fso.GetDrive($r.Path)
$outputObj = Build-Object $r.Name $r.Path $storage.AvailableSpace $storage.TotalSize
}
$outputAry = $outputAry + $outputObj
}
}
End {
$outputAry
}
}
Code: Select all
Get-VBRBackupRepository -Name "My Repo" | Get-vPCRepoInfo
Code: Select all
storepath : E:\Backups
FreePercentage : 63
StorageTotal : 824.00
StorageFree : 522.05
Target : My Repo
-
- Novice
- Posts: 4
- Liked: never
- Joined: Feb 20, 2012 11:00 am
- Full Name: Tommaso Cecchi
- Contact:
Re: Repository size
Thomas, thanks for your immediate and quick reply. Works perfectly for me. I'll just try to convert the output in a sort of csv format (not actually a guru in powershell so ... it could take a while) and post it here.ThomasMc wrote:This is the cmdlet I use for the vPC Army Report that you can't tweak to your needs
Thanks again,
Tommaso
-
- Veteran
- Posts: 293
- Liked: 19 times
- Joined: Apr 13, 2011 12:45 pm
- Full Name: Thomas McConnell
- Contact:
Re: Repository size
You could do this
Code: Select all
#Save output to CSV
Get-VBRBackupRepository -Name "My Repo" | Get-vPCRepoInfo | Export-Csv C:\Test.csv -NoTypeInformation
#Open the file with default viewer
Invoke-Expression C:\Test.csv
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Jul 16, 2016 3:13 pm
- Full Name: Wasawatt
- Contact:
Re: Repository size
Hi Thomas,
I try to follow you and I use Veeam BR9. on Windows Server 2008R2 with Powershell v4.
but unfortunately I got this error for about 'Create' method of "[Veeam.Backup.Core.CRemoteWinFileCommander]".
could you or everyone guide me to fix this issue.
regards and Thank you,
Wasawatt
I try to follow you and I use Veeam BR9. on Windows Server 2008R2 with Powershell v4.
but unfortunately I got this error for about 'Create' method of "[Veeam.Backup.Core.CRemoteWinFileCommander]".
Code: Select all
----------------------------------------
Method invocation failed because [Veeam.Backup.Core.CRemoteWinFileCommander]
does not contain a method named 'Create'.
At line:28 char:13
+ $FileCommander =
[Veeam.Backup.Core.CRemoteWinFileCommander]::Create ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
You cannot call a method on a null-valued expression.
At line:29 char:13
+ $storage = $FileCommander.GetDrives([ref]$null) | ?{$_.Name -eq
$r.P ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Attempted to divide by zero.
At line:11 char:10
-------------------------------------------
regards and Thank you,
Wasawatt
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Repository size
The workaround provided above used unsupported and undocumented approach that has ceased to exist already.
What information are you trying to get? Repository utilization? Don't you have a Veeam ONE deployed by any chance?
Thanks.
What information are you trying to get? Repository utilization? Don't you have a Veeam ONE deployed by any chance?
Thanks.
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Jul 16, 2016 3:13 pm
- Full Name: Wasawatt
- Contact:
Re: Repository size
Hi,
I need to check to size of VM is fit with repository before create job. due to I integrate with VMware and need to create some logic to check.
for Veeam ONE i am not deploy it. I use on;y Veeam Backup & Replicate and Enterprise Manager.
Regards,
I need to check to size of VM is fit with repository before create job. due to I integrate with VMware and need to create some logic to check.
for Veeam ONE i am not deploy it. I use on;y Veeam Backup & Replicate and Enterprise Manager.
Regards,
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Repository size
You can use this tool to get general idea on how much space will be occupied on a repository. Thanks.
Who is online
Users browsing this forum: No registered users and 5 guests