PowerShell script exchange
Post Reply
nd39475
Enthusiast
Posts: 61
Liked: 7 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Why does ImportVBRBackup use -Server instead of -Name?

Post by nd39475 »

Why does ImportVBRBackup use -Server (FQDN) instead of -Name.

I'm having to force the FQDN like below which does not flow with other VBR cmdlets.

Code: Select all

$VeeamServer="MyServerHostName"
Get-VBRBackupRepository -Name $VeeamServer
[....stuff...]
Import-VBRBackup -Server "$VeeamServer.$env:USERDNSDOMAIN" -FileName "blahblah"
and this only works because my veeam server name happens to be the hostname. If it were different it would be more of a PITA:

I can't even use $FQDN=(Get-VBRBackupRepository -Name $VeeamServer).Host because ".Host" is not usable even though it's a table header returned by Get-VBRBackupRepository.

Also, off subject, Get-VBRBackupRepository's .FullPath property returns "E:|Backups" instead of "E:\Backups"
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Why does ImportVBRBackup use -Server instead of -Name?

Post by veremin »

The import wizard in backup server allows you to import backup from any server added to the backup console. It uses FQDN under which servers were added to the backup console. PowerShell cmdlet follows the same pattern. Thanks.
nd39475
Enthusiast
Posts: 61
Liked: 7 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Why does ImportVBRBackup use -Server instead of -Name?

Post by nd39475 »

Thank you, I'd like to formally request a fix of

Code: Select all

(Get-VBRBackupRepository -Name $VeeamServer).Host
and less importantly

Code: Select all

(Get-VBRBackupRepository -Name $VeeamServer).FullPath
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Why does ImportVBRBackup use -Server instead of -Name?

Post by veremin »

1) Import-VBRBackup cmdlet СHost as -Server parameter, not a string one. It seems that you're trying to address the problem from a different angle. Thus, the concern regarding internal parameter .Host that servers a different purpose.
2) .Path parameter seems to have a formatting you're after.
nd39475
Enthusiast
Posts: 61
Liked: 7 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Why does ImportVBRBackup use -Server instead of -Name?

Post by nd39475 »

It seems if i could get the FQDN or HostName of a server from Get-VBRBackupRepository or Get-VBRServer, then i'd be able to use it for Import-VBRBackup -Server rather than having to set 2 different variables representing a veeam server. (Name & Server) -- It's just a logic issue to me.

Yes, both .FriendlyPath and .Path are circumventions to the erroneous .Fullpath .

Thank you.
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Why does ImportVBRBackup use -Server instead of -Name?

Post by tsightler »

As noted above, the -Server parameter normally doesn't want a string, it wants a [CHost} object. The Get-VBRServer cmdlet returns [CHost] objects, and allows filter by Name so, assuming the hosts were added to VBR by FQDN, then something like this:
Import-VBRBackup -Server (Get-VBRServer -Name "myrepo.foobar.com")
The cmdlet will also accept a repository object [CBackupRepostiory] via the -Repository parameter:
Import-VBRBackup -Repository (Get-VBRBackupRepository -Name "My Repo")
You don't need the FQDN strings, if you have either the [CHost] object or the [CBackupRepostiory] object, just pass the entire object to the parameter. In other words, you initial code should just be:

Code: Select all

$VeeamServer="MyServerHostName"
Get-VBRBackupRepository -Name $VeeamServer
[....stuff...]
Import-VBRBackup -Repository "$VeeamServer" -FileName "blahblah"
nd39475
Enthusiast
Posts: 61
Liked: 7 times
Joined: May 05, 2016 6:28 pm
Full Name: n d
Contact:

Re: Why does ImportVBRBackup use -Server instead of -Name?

Post by nd39475 »

Awesome, TYVM.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests