PowerShell script exchange
Post Reply
marcseitz
Influencer
Posts: 18
Liked: 5 times
Joined: Apr 04, 2012 11:17 am
Full Name: Marc Seitz
Contact:

Free Space of CIFS-Repository

Post by marcseitz »

Hi Guys,

we are moving from a Windows-Share to a CIFS-Share and I have to customize our Powerhell Scripts.
At the moment I'm getting the free Space of the Windows Repository with an command like his:

Code: Select all

$myRep = Get-VBRBackupRepository | ?{$.Name -eq "XXX"}
$myServer = $myRep.GetHost()
$MyFileCommander = [Veeam.Backup.Core.CRemoteWinFileCommander]::Create($myServer.Info)
$myStorage = $MyFileCommander.GetDrives([ref]$null) | ?{$_.Name -eq $myRep.Path.Substring(0,3)}
$myFree = [Math]::Round([Decimal]$myStorage.FreeSpace/1GB,0)
I didn't find anything how to do this for a CIFS-Share.
In the B&R Application I can see the free Space of the CIFS Share - But not via Powershell :(


Has anyone an idea how to do this?

Thanks,
Marc
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Free Space of CIFS-Repository

Post by veremin »

In the way I see it, something like this should answer your requirements:

Code: Select all

Add-PSSnapin VeeamPSSnapin
$myRep = Get-VBRBackupRepository | ?{$_.Name -eq "Name of your repository"}
[Math]::Round([Decimal](new-object -com scripting.filesystemobject).getdrive($myRep.path).availablespace/1GB)

I've just tested it and everything seems to work fine.

Hope this helps.
Thanks.
marcseitz
Influencer
Posts: 18
Liked: 5 times
Joined: Apr 04, 2012 11:17 am
Full Name: Marc Seitz
Contact:

Re: Free Space of CIFS-Repository

Post by marcseitz »

Hi Vladimir,

thanks for your quick answer - Your Snipplet is working!

Now I just have the problem that the Script will return "16384" (16TB).
But the Share has an amount of 35TB :-/

I don't know why there is such an difference. I think, I have to go to use Powershell-CMDlets from my Storage Provider to get the correct values.

Thanks & Regards,
Marc
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Free Space of CIFS-Repository

Post by veremin »

You mean 35 TB of free space, don’t you? And this value (35 TB) is also shown in the VB&R GUI?

Hard to say what can be the issue, since in my particular environment abovementioned script appears to work properly.

Perhaps, later I’ll come up with some new script that will be responsible for getting free space, using different methods.

Thanks.
marcseitz
Influencer
Posts: 18
Liked: 5 times
Joined: Apr 04, 2012 11:17 am
Full Name: Marc Seitz
Contact:

Re: Free Space of CIFS-Repository

Post by marcseitz »

Hi,

yes - I'm really talking of 35TB free space!
In the VB&R GUI I can see 35,0TB free!
The System behind is a NetApp Filer, connected to Veeam via CIFS Share.

But no worries - If it doesn't work with Veeam CMDlets, I have to use NetApp-CMDlets to get it working.
Not very nice, but should work too!

Thanks,
Marc
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests