PowerShell script exchange
Post Reply
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Veeam Explorers PowerShell Reference

Post by manfred.milhofer »

Hello

I have a case open with Veeam support - Case # 07707688 - "Trying to achieve unattended restore on Windows"

The support engineer has suggested that I try using the PowerShell approach documented here:

https://helpcenter.veeam.com/docs/backu ... ml?ver=120

But I can't get past step 1, here is what I get when I try to run this:

Code: Select all

---------------------------------------------------- start PowerShell snippet -------------------------------------------

Welcome to the Veeam Backup and Replication PowerShell Toolkit!

To list available commands, type Get-VBRCommand
To open online documentation on all available commands, type Get-VBRToolkitDocumentation

© Veeam Software Group GmbH. All rights reserved.


PS C:\Users\manfred.milhofer> $restorepoint = Get-VBRApplicationRestorePoint -Oracle
>> Start-VEORRestoreSession -RestorePoint $restorepoint[0]
>>
Cannot index into a null array.
At line:2 char:1
+ Start-VEORRestoreSession -RestorePoint $restorepoint[0]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

PS C:\Users\manfred.milhofer>

---------------------------------------------------- end PowerShell snippet -------------------------------------------
Is anyone able to point me in the right direction?
Thanks
Manfred
david.domask
Veeam Software
Posts: 2813
Liked: 641 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam Explorers PowerShell Reference

Post by david.domask »

Hi Manfred,

>Cannot index into a null array.

Here Powershell is telling that $restorepoint is empty -- $restorepoint[0] tells Powershell to read the first element from the array $restorepoint, but looks like $restorepoint didn't populate correctly.

Can you explain a bit more about the situation? I understand you're doing Oracle restores, but how were they backed up?

1. VM backup (Vmware, HyperV, etc)
2. RMAN Plugin
2.1 If RMAN, what mode was it operating in?

Just it looks like Get-VBRApplicationRestorePoint wasn't able to find any. If you run it without the -Oracle parameter, do you see your restore points?
David Domask | Product Management: Principal Analyst
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Re: Veeam Explorers PowerShell Reference

Post by manfred.milhofer »

Hi David

Thanks for getting back to me.
The backups were created using Oracle RMAN plugin from VBR.

I tried the Get-VBRApplicationRestorePoint command without the -Oracle switch, but the result was exactly the same.

Thanks
Manfred
david.domask
Veeam Software
Posts: 2813
Liked: 641 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam Explorers PowerShell Reference

Post by david.domask »

Got it, I think there's just a minor confusion but it's not always the clearest.

You want:

Get-VEORRMANBackup
Start-VEORRMANRestoreSession

Check the examples on those pages, you start with fetching the backup and then pass the VEORRMANBackup object to Start-VEORRMANRestoreSession.

Get-VBRApplicationRestorePoint is meant for image level backups of physical/virtual machines with Application Aware Processing, but I can get the confusion a bit. I will ask the tech writers managing these user guide pages to please make it a bit more clear on both pages.
David Domask | Product Management: Principal Analyst
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Re: Veeam Explorers PowerShell Reference

Post by manfred.milhofer » 1 person likes this post

Hi David

Thanks so much for that. I would have been floundering for some time without your direction.

Regards
Manfred
david.domask
Veeam Software
Posts: 2813
Liked: 641 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam Explorers PowerShell Reference

Post by david.domask »

Happy I could help Manfred; were you able to get your restores going?

A hint on our Powershell reference, you can check the applicable types of backups (hypervisors) based on the "Applies to" section on each page; for example from Get-VBRApplicationRestorePoint:
Applies to

Platform: VMware, Hyper-V, Veeam Agent
Doesn't necessarily help with discovery of the correct cmdlet, but hopefully will save you some time when testing.
David Domask | Product Management: Principal Analyst
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Re: Veeam Explorers PowerShell Reference

Post by manfred.milhofer »

Hi David

I'll have a go at an actual restore next week I think.

Thanks
Manfred
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Re: Veeam Explorers PowerShell Reference

Post by manfred.milhofer »

Hi David

Apologies for leaving this so long, but we have ended up taking a different route. The RMAN plugin was not working for us so we are now using VM backups with application aware processing for the Oracle databases. This is working well so far but we are now looking for a way to use PowerShell to run backups.

We have tried the following which works up to a point but returns an error after a few steps, if you have time to look at this and point me in the right direction it would be very much appreciated.

Thanks
Manfred

------------------------------------------------------------------------------------------------------------

Code: Select all

Welcome to the Veeam Backup and Replication PowerShell Toolkit!

To list available commands, type Get-VBRCommand
To open online documentation on all available commands, type Get-VBRToolkitDocumentation

© Veeam Software Group GmbH. All rights reserved.


PS C:\Users\manfred.milhofer> $jobName = "oracle-horizon-QBZADBSDEMO01"
PS C:\Users\manfred.milhofer> $job = Get-VBRJob -Name $jobName
WARNING: This cmdlet is no longer supported for computer backup jobs. Use
"Get-VBRComputerBackupJob" instead.
PS C:\Users\manfred.milhofer> $job = Get-VBRComputerBackupJob -Name $jobName
PS C:\Users\manfred.milhofer> $vbrVm = Get-VBRVM -Name $job.Name
Get-VBRVM : The term 'Get-VBRVM' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:10
+ $vbrVm = Get-VBRVM -Name $job.Name
+          ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-VBRVM:String) [], CommandNotFoundExceptio
   n
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\manfred.milhofer>
At this point we would be hoping to run:

Code: Select all

Start-VBRQuickBackup -VM $vbrVm -Verbose
david.domask
Veeam Software
Posts: 2813
Liked: 641 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam Explorers PowerShell Reference

Post by david.domask »

Hi Manfred,

No worries about delays, and sorry to hear the RMAN plugin didn't quite meet your needs.

Just to confirm, you simply want to start the backup jobs?

Should be as simple as:

Code: Select all

$job = Get-VBRJob -Name "name of the backup job"
Start-VBRJob -Job $job -RunAsync #RunAsync flag is set so script doesn't have to wait for the job to finish before the script completes.
Get-VBRVM isn't a Veeam cmdlet, so that's why it didn't work, but perhaps I'm misunderstanding what you're trying to accomplish -- you want to start/stop the entire VM backup job or start a backup for just one machine added to a job?
David Domask | Product Management: Principal Analyst
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Re: Veeam Explorers PowerShell Reference

Post by manfred.milhofer »

Hi David

Thanks again for getting back to me.

I think we do have what we need, but since you have been so helpful I will push my luck and ask you to confirm a couple of things that we are not 100% sure about.

First - when we run Get-VBRJob we receive a warning:

$job = Get-VBRJob -Name "oracle-horizon-QBZADBSDEMO01"
>>
WARNING: This cmdlet is no longer supported for computer backup jobs. Use "Get-VBRComputerBackupJob" instead.

From the docs it looks as though this is because the job has been created via the agent, so instead we need to run:

$job = Get-VBRComputerBackupJob -Name "oracle-horizon-QBZADBSDEMO01"

Are we correct in that?


At this point we have successfully run two variants:

Start-VBRComputerBackupJob -Job $job -Verbose
and
Start-VBRJob -Job $job

Both appear to do exactly the same thing - is this correct? Should we be running one or the other?

Lastly, we would like to know for sure what a "Quick backup" does (from the VBR console). My theory is that it is a quick way to run all backup jobs for a specific host - if this is so then we don't need to worry about it, since we only ever have one backup job per host.

Many thanks in advance for all your help.
Manfred
david.domask
Veeam Software
Posts: 2813
Liked: 641 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam Explorers PowerShell Reference

Post by david.domask »

Hi Manfred, you're quite welcome.
First - when we run Get-VBRJob we receive a warning:

$job = Get-VBRJob -Name "oracle-horizon-QBZADBSDEMO01"
>>
WARNING: This cmdlet is no longer supported for computer backup jobs. Use "Get-VBRComputerBackupJob" instead.
Correct, in previous versions, Get-VBRJob was the only entry point for getting a CJob object, but each platform is getting its own cmdlets over time. So if it's an Agents job, use Get-VBRComputerBackupJob
Start-VBRComputerBackupJob -Job $job -Verbose
and
Start-VBRJob -Job $job
It's best to match cmdlets to their partner, i.e., Get-VBRJob / Start-VBRJob. While Start-VBRJob will work for both in current version, probably best to use the pairs appropriately.
Lastly, we would like to know for sure what a "Quick backup" does (from the VBR console). My theory is that it is a quick way to run all backup jobs for a specific host - if this is so then we don't need to worry about it, since we only ever have one backup job per host.
Not quite; a Quick Backup is an on-demand incremental for a given machine already in a job. You might want to do this, for example, if your AV indicated potentially malicious activity and you want to capture the state of the machine for investigation in a clean room for example with SureBackup, or maybe you're about to do patching and want a very recent rollback point. The whole idea is you can do an out-of-band incremental backup for whatever reason.
David Domask | Product Management: Principal Analyst
manfred.milhofer
Influencer
Posts: 10
Liked: 3 times
Joined: Apr 01, 2025 10:58 am
Full Name: Manfred Milhofer
Contact:

Re: Veeam Explorers PowerShell Reference

Post by manfred.milhofer » 1 person likes this post

Thanks David, you have been really helpful, very much appreciated :)

Manfred
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests