PowerShell script exchange
Post Reply
TSV
Lurker
Posts: 2
Liked: never
Joined: Feb 19, 2016 8:35 pm
Full Name: Jason Doppes
Contact:

Start-VBRWindowsFileRestore:Return argument has invalid type

Post by TSV »

Hi,

Was instructed by Veeam support to post this issue here since it's apparently script related. Case for that was 01703522.

Trying to play with the VBR Powershell modules on Veeam B&R 9.0 as described in the command help page on in the helpcenter: https://helpcenter.veeam.com/backup/pow ... store.html.

I'm unable to initialize the file restore session as Powershell complains about the restore point object I pipe through as an invalid argument type or is a seemingly incompatible object. Below is the code I just ran to reproduce the error by following the KB article:

Code: Select all

$result = Get-VBRBackup | where {$_.jobname -like "*ServerDC01*"} | Get-VBRRestorePoint | where {$_.name -like "*ServerDC01*"} | Sort-Object creationtime -Descending | Select-Object -First 1 | Start-VBRWindowsFileRestore
Results in the following output:

Code: Select all

Start-VBRWindowsFileRestore : Return argument has an invalid type.
At line:1 char:216
+ $result = Get-VBRBackup | where {$_.jobname -like "*ServerDC01*"} | Get-VBRRestorePoint | where {$_.name -like "*ServerDC
01"} | Sort-Object creationtime -Descending | Select-Object -First 1 | Start-VBRWindowsFileRestore <<<<
    + CategoryInfo          : NotSpecified: (:) [Start-VBRWindowsFileRestore], InvalidCastException
    + FullyQualifiedErrorId : System.InvalidCastException,Veeam.Backup.PowerShell.Command.StartVBRWindowsFileRestore
The command pipe chain seems to sort and filter the restore point object correctly:

Code: Select all

$result = Get-VBRBackup | where {$_.jobname -like "*ServerDC01*"} | Get-VBRRestorePoint | where {$_.name -like "*ServerDC01*"} | Sort-Object creationtime -Descending | Select-Object -First 1 | Start-VBRWindowsFileRestore
Output:

Code: Select all

Info               : Veeam.Backup.Model.COibInfo
Id                 : ce25fca3-eea8-4157-9323-61d5c89f5bbd
LinkIdNullable     : 55ac8608-e8e0-4170-8c00-ea59b76ae922
OriginalOibId      : ce25fca3-eea8-4157-9323-61d5c89f5bbd
LinkId             : 55ac8608-e8e0-4170-8c00-ea59b76ae922
CreationTime       : 3/1/2016 9:03:18 PM
CreationTimeUtc    : 3/2/2016 2:03:18 AM
Type               : Increment
Algorithm          : Increment
PointId            : 37fd338f-92ec-43b8-8877-30386699c2bd
ObjectId           : 094f414c-3ff4-406e-9001-4616753b7695
StorageId          : c2ce2266-1d7b-458b-98d7-ad4991e83ede
InsideDir          : 28a7ab42-3ea9-483b-9572-2c26ebba5a38
IsCorrupted        : False
IsRecheckCorrupted : False
IsLicensed         : True
IsConsistent       : True
ApproxSize         : 912683696128
VmName             : ServerDC01
Name               : ServerDC01
State              : Nothing
EffectiveMemoryMb  : 7168
GuestInfo          : Veeam.Backup.Model.CGuestInfo
AuxData            : Veeam.Backup.Core.CViOibAuxData
ParentId           : 00000000-0000-0000-0000-000000000000
DisplayName        : ServerDC01
HvAuxData          :
HasIndex           : True
HasExchange        : False
HasSharePoint      : False
HasSql             : False
HasAd              : True
HasOracle          : False
Fqdn               : ServerDC01.domain.local
BackupId           : 5f9300ba-cca9-45f3-8ff2-308499085a82
LinkableType       : Oib
IsFull             : False
MountToFull        : True
I've been able to reproduce this behavior for all the other backup jobs associated with this Veeam install as well. The server is Windows 2008 R2 with all updates applied and the Powershell console version is still 2.0. The backups have been running error free for awhile.

Hoping somebody can assist with clarifying what the root cause might be causing this behavior or if I'm missing a step.

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

Re: Start-VBRWindowsFileRestore:Return argument has invalid

Post by veremin »

I've just checked the referenced code, everything seems to be working fine. So, I suspect PowerShell 2.0 being the issue here. We've seen multiple odd problems related to it.

Kindly, update PS and see whether the issue persists.

Thanks.
TSV
Lurker
Posts: 2
Liked: never
Joined: Feb 19, 2016 8:35 pm
Full Name: Jason Doppes
Contact:

Re: Start-VBRWindowsFileRestore:Return argument has invalid

Post by TSV »

Hi,

The Powershell version on the server was updated from 2.0 to 3.0 and I was able to successfully run the command and create the restore mount object with the code in the original post.

I would consider this particular issue closed. Many thanks for the suggestion.
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRWindowsFileRestore:Return argument has invalid

Post by veremin »

You're welcome. Another bizarre PS 2.0 problem has been solved by updating of PowerShell, thanks for sharing; appreciated.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests