PowerShell script exchange
Post Reply
veremin
Product Manager
Posts: 20261
Liked: 2249 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Is your analysis still in progress or can you already give me an opinion?
The script works in my (and many other environments), so, it's up to you to take the suggested actions to spot the problem. Thanks!
emcclure
Influencer
Posts: 22
Liked: never
Joined: Oct 23, 2018 9:02 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by emcclure »

So I've been running a script on Veeam Backup 9.4 to backup multiple VM's which has been going great. I looked today at the email and 1 had warning and another had failed. Looking at the warning one it was complaining about snapshots, so I removed them since they weren't needed. The 2nd one has a snapshot from January and I think was recently added to the backup. The script for this vCenter creates a csv file that pulls in the latest VM's in the specified VM folder (As they can change from time to time) and then backs those up. It looks like this has failed on the last 2 and has only been a part of the last 2 backups for it. These are run every 3 days. I'm looking in %PROGRAMDATA%\Veeam\Backup but not seeing any reference to that VM. How do I determine the reason the backup failed for this one? It appears to be running Server 2k8R2. Thanks in advance.
veremin
Product Manager
Posts: 20261
Liked: 2249 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

What does backup console show for this particular VeeamZIP session? Thanks!
emcclure
Influencer
Posts: 22
Liked: never
Joined: Oct 23, 2018 9:02 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by emcclure »

I don't see anything. Should I? The machines that are successful show successful. The one with the warning showed a warning. I don't see anything for failures at all. Only recent change I made was adding a new host into Veeam that's in the same cluster as the other hosts, however this host doesn't have the failed VM in question, so I don't know what else to say here at the moment.
veremin
Product Manager
Posts: 20261
Liked: 2249 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Then, it seems that backup activity has not been started for those VMs.

You might want to check the script line by line to catch the issue, especially, the portion where VMs get assigned to variable - whether it contains VMs in question.

Thanks!
emcclure
Influencer
Posts: 22
Liked: never
Joined: Oct 23, 2018 9:02 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by emcclure »

Hmm so I don't think it's the script. I just looked at the csv file that was created by the first script and sure enough the VM that's failing to backup is there in the csv file along with all the other VM's that backed up without issue (including the one that had the warning for the snapshots).

The script to get the VM's into a csv is as follows (Minus my specific info of course)

Code: Select all

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

$vCName = "myvcenter.domain"
$vcUser = "myuser"
$vcPass = "mypass"
Connect-VIServer -Server $vcName -User $vcUser -Password $vcPass

Get-Datacenter -Name Management | Get-Folder -Name MyFolder | Get-VM | Select Name | Export-csv D:\BackupScript\VMstoBackup.csv
This has been working since the beginning of July.

In the backup script I have this at the beginning:

Code: Select all

$VMNames = Import-csv -Path "D:\BackupScript\VMstoBackup.csv"
Then all the stuff that's defined for my backup and then this:

Code: Select all

 Asnp VeeamPSSnapin

    $mbody = @()
    $VMName = ""

	#$VMs = Find-VBRViEntity -Name * | where {$_.type -eq "VM"}
	
    foreach ($VMName in $VMNames)
    {
	
	$VM = Find-VBRViEntity -Name $VMName.Name
	
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention

    If ($EnableNotification)
    {
    $TaskSessions = $ZIPSession.GetTaskSessions()
    $FailedSessions = $TaskSessions | where {$_.status -eq "EWarning" -or $_.Status -eq "EFailed"}

    if ($FailedSessions -ne $Null)
    {
    $mbody = $mbody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={$FailedSessions.Title}})
    }

    Else
    {
    $mbody = $mbody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={($TaskSessions | sort creationtime -Descending | select -first 1).Title}})
    }

    }
    }
    If ($EnableNotification)
    {
    Send-MailMessage -From $EmailFrom -To $EmailTo -Cc $EmailCC -Subject $EmailSubject -Body ($mbody | Out-String)  -SmtpServer $smtpServer
    }
So I don't understand how 1 VM in a list of 20 or more VM's fails and the rest work just fine. This is all on a scheduled task and the first script runs before the backup script so the list is current each time.
veremin
Product Manager
Posts: 20261
Liked: 2249 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

If the backup console does not show a session for VM in question, it means that backup server has not even tried to process this VM.

That's why you need to check the content $VMs variable and see whether it includes problematic VM. If it does, you can try to run VeeamZIP activity only against this VM and see what happens.

Also, you might try to verify whether you can back it up using GUI.

Thanks!
alltm
Lurker
Posts: 1
Liked: never
Joined: Jun 10, 2020 2:45 pm
Full Name: AT
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by alltm »

Hi,

Is there an easy way to set the Retry options as it appears the defaults are 3 retries with 10-minute timeouts? Could these defaults be changed (via registry or the script), has anyone tried this? Seems for whatever reason sometimes 3 every 10 minutes is not enough and setting these to 10 retries every 5 minutes would make more sense potentially, is this possible?

Thank you!
Egor Yakovlev
Veeam Software
Posts: 2532
Liked: 676 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Location: Prague, Czech Republic
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Egor Yakovlev »

There is no schedule for VeeamZIP(which is discussed under this thread), however for any other job you can Set-VBRJobScheduleOptions created with New-VBRJobScheduleOptions where Retry settings are available.

Code: Select all

$newschedule = New-VBRJobScheduleOptions
$newschedule.RetrySpecified = $true
$newschedule.RetryTimeout = 5
$newschedule.RetryTimes = 10
/Cheers!
Debs
Lurker
Posts: 2
Liked: never
Joined: May 05, 2021 1:37 pm
Full Name: Deborah La Monica
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Debs »

In my case, there is just one error.

In an attempt to back up multiple machines, those machines backups are stored on the same directory of a NAS QNAP.

The 1st one fails with “access denied”, the remainings ends the backup without any issue.




How can be possible?
veremin
Product Manager
Posts: 20261
Liked: 2249 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Seems like backup service account does not have required permissions, as the result the script fails.

You can try to:

- run the script under administrator account
- specify credentials to network share, using -NetworkCredentials parameter (of Start-VBRZip cmdlet)

Thanks!
Debs
Lurker
Posts: 2
Liked: never
Joined: May 05, 2021 1:37 pm
Full Name: Deborah La Monica
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Debs »

My batch back-up 4 machines :
$VMNames = "machine1","machine2","machine3","machine4"
The first one ends with error :
"Processing "machine1" Error: Access is denied.
Could not perform threshold check for backup location "\\qnas_ip\backup_veeam01\VeeamZIPDir" due to space info retrievement fail!"

The other one ends without error
Thank you in advanced
Deborah
veremin
Product Manager
Posts: 20261
Liked: 2249 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Looks a bit strange, so it might be worth playing with different accounts (you execute the script under) or reaching support team for further investigation. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests