PowerShell script exchange
Post Reply
mckaynz
Lurker
Posts: 1
Liked: never
Joined: Jul 07, 2017 1:42 am
Contact:

[MERGED] Veeam free Reverse Incremental Backup via Powershel

Post by mckaynz »

Just wondering if it is possible to Reverse Incremental Backups via powershell if you are using the Free addition.

I have the PS script that Vladimir Eremin created but id does not have the option for Reverse Incremental Backups

IS this an option that is only in the Paid additions.

Cheers

LAwrence
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Free edition does not support incremental backup. Thanks.
KMeli
Novice
Posts: 7
Liked: never
Joined: Apr 13, 2017 4:27 pm
Full Name: Karen Meli
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by KMeli »

Code: Select all

ind-VBRViEntity : Cannot validate argument on parameter 'Server'. The argument is null. Provide a valid value for the
argument, and then try running the command again.
At line:3 char:48
+   $VM = Find-VBRViEntity -Name $VMName -Server $Server
+                                                ~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Find-VBRViEntity], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Command.FindVBRViEntity
found vm:

Code: Select all

Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Provide a valid value for the
argument, and then try running the command again.
At line:12 char:40
+     $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+                                        ~~~
    + CategoryInfo          : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip
I am getting this error in running the script. Is this permissions related?
Thank you
MiguelLagos
Lurker
Posts: 2
Liked: never
Joined: Apr 07, 2017 12:37 am
Full Name: Miguel Angel Lagos
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by MiguelLagos »

After a few months I'm Back!!!

Write-Host $Server returns: Veeam.Backup.Core.Common.Chost

Find-VBRHvEntity -Server $Server

returns nothing

Find-VBRHvEntity -Server (Get-VBRServer -name "name of your server")

returns nothing


Get-VBRServer -name "name of your server"

returns the right server information.


Miguel Lagos
veremin
Product Manager
Posts: 20270
Liked: 2252 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 virtual platform you're using? VMware or Hyper-V one?
KMeli
Novice
Posts: 7
Liked: never
Joined: Apr 13, 2017 4:27 pm
Full Name: Karen Meli
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by KMeli »

Hi I am on VM platform Thank you
KMeli
Novice
Posts: 7
Liked: never
Joined: Apr 13, 2017 4:27 pm
Full Name: Karen Meli
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by KMeli »

Miguel Lagos

Thank you!!!!!!!!
r.castello
Influencer
Posts: 11
Liked: never
Joined: Jul 12, 2017 10:31 am
Full Name: Ruben
Contact:

[MERGED] Retention Policy issues...

Post by r.castello »

Hi,

I'm facing the same issue with retention policy.
We have 2 Vmware clusters "Cluster1" and "Cluster2". Cluster 1 is licensed to use with Veeam and I was trying to use https://www.veeam.com/blog/es-lat/veeam ... shell.html for Cluster2.

Everything is working fine except Retention, this is set to "Tonight" for testing and backups are not deleted. This backups are stored locally on the machine where Veeam runs, so i think is not a permission problem.

We use Veeam Backup&Replication 9.5 Update 2

Code: Select all

Author: Vladimir Eremin
# Created Date: 3/24/2015
# http://forums.veeam.com/member31097.html
# 

##################################################################
#                   User Defined Variables
##################################################################

# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames = “VM1”,”VM2”
$VMNames = "Machine1","Machine2"

# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = "vcenter.XXXXXX.XX"

# Directory that VM backups should go to (Mandatory; for instance, C:\Backup)
$Directory = "D:\VeeamBackup"

# Desired compression level (Optional; Possible values: 0 - None, 4 - Dedupe-friendly, 5 - Optimal, 6 - High, 9 - Extreme) 
$CompressionLevel = "5"

# Quiesce VM when taking snapshot (Optional; VMware Tools are required; Possible values: $True/$False)
$EnableQuiescence = $True

# Protect resulting backup with encryption key (Optional; $True/$False)
$EnableEncryption = $False

# Encryption Key (Optional; path to a secure string)
$EncryptionKey = ""

# Retention settings (Optional; By default, VeeamZIP files are not removed and kept in the specified location for an indefinite period of time. 
# Possible values: Never , Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)
$Retention = "Tonight"

##################################################################
#                   Notification Settings
##################################################################

# Enable notification (Optional)
$EnableNotification = $false

# Email SMTP server
$SMTPServer = ""

# Email FROM
$EmailFrom = "" 

# Email TO
$EmailTo = ""

# Email subject
$EmailSubject = ""

##################################################################
#                   Email formatting 
##################################################################

$style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }"
$style = $style + "TD{border: 1px solid black; padding: 5px; }"
$style = $style + "</style>"

##################################################################
#                   End User Defined Variables
##################################################################

#################### DO NOT MODIFY PAST THIS LINE ################
Asnp VeeamPSSnapin

$Server = Get-VBRServer -name $HostName
$MesssagyBody = @()

foreach ($VMName in $VMNames)
{
  $VM = Find-VBRViEntity -Name $VMName -Server $Server
  
  If ($EnableEncryption)
  {
    $EncryptionKey = Add-VBREncryptionKey -Password (cat $EncryptionKey | ConvertTo-SecureString)
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention -EncryptionKey $EncryptionKey
  }
  
  Else 
  {
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
  }
  
  If ($EnableNotification) 
  {
    $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
    $FailedSessions =  $TaskSessions | where {$_.status -eq "EWarning" -or $_.Status -eq "EFailed"}
  
  if ($FailedSessions -ne $Null)
  {
    $MesssagyBody = $MesssagyBody + ($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
  {
    $MesssagyBody = $MesssagyBody + ($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)
{
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
$SMTP.Send($Message)
}

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

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Hi I am on VM platform Thank you
Then, you need to leverage VMware version of the script, currently you're using Hyper-V one. Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Everything is working fine except Retention, this is set to "Tonight" for testing and backups are not deleted.
Can you try to reproduce the issue via GUI and provide me with the results of your findings?
r.castello
Influencer
Posts: 11
Liked: never
Joined: Jul 12, 2017 10:31 am
Full Name: Ruben
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by r.castello »

v.Eremin wrote:Can you try to reproduce the issue via GUI and provide me with the results of your findings?
I made 2 VeeamZip yesterday, one with GUI and the other one with powershell. Today it worked greated, maybe I made some mistakes on the first attempt, so sorry.

Just a little question more, the folder specified("D:\VeeamBackup") on both (GUI and powershell ) got deleted, there is no folder now. In the folder there were only the VeeamZip files so after retention it was empty, but I'm surprised folder is deleted too. Is this the normal behaviour?

Thanks and sorry again, this is amazing script!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

The folder should stay intact, actually.
CRKeo
Lurker
Posts: 2
Liked: never
Joined: Nov 15, 2016 3:25 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by CRKeo »

Hi,

Using the script posted on the website with no issues but I was wondering if there was a way I could read in all the VMs I want to backup from a text file rather than specify them individually in the script? Did give it a quick try with Get-Content but didn't seem to work, could just be me though getting it wrong.

Thanks
hawkeye871
Lurker
Posts: 1
Liked: never
Joined: Jul 31, 2017 12:03 pm
Contact:

excluding specific vhdx

Post by hawkeye871 »

Hello.
I use Veeam Backup & replication for Hyper-V 9.5 free edition with the standart Power Shell script. With this script i can specify VMs that i want to back up, VMs have a couple of vhdx disk but i need to exclude one of vhdx. How can i establish it via Power Shell? Thanks.
proactis
Novice
Posts: 3
Liked: never
Joined: Jun 14, 2011 9:41 am
Contact:

[MERGED] Start-VBRZip with retention

Post by proactis »

I have create a very simple powershell script as a test to backup for now but it seems to ignore the -AutoDelete and seems to delete the day after. Is there a way of seeing what veema has issued to the zip backup as retention policy

$VM = "Server1"
$BackupPath = "E:\backup\"
Start-VBRZip -Entity $VM -Folder $BackupPath -Compression 9 -AutoDelete In3Days
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

I have create a very simple powershell script as a test to backup for now but it seems to ignore the -AutoDelete
Try to set retention via GUI and open a support ticket if the problem is reproduced. Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

I use Veeam Backup & replication for Hyper-V 9.5 free edition with the standart Power Shell script. With this script i can specify VMs that i want to back up, VMs have a couple of vhdx disk but i need to exclude one of vhdx. How can i establish it via Power Shell? Thanks.
You cannot exclude disks from processing in VB&R Free edition. Thanks.
amatthews
Lurker
Posts: 2
Liked: never
Joined: Aug 03, 2017 1:47 pm
Full Name: Andrew Matthews
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by amatthews »

proactis wrote:I have create a very simple powershell script as a test to backup for now but it seems to ignore the -AutoDelete and seems to delete the day after. Is there a way of seeing what veema has issued to the zip backup as retention policy

$VM = "Server1"
$BackupPath = "E:\backup\"
Start-VBRZip -Entity $VM -Folder $BackupPath -Compression 9 -AutoDelete In3Days
Hi
I had a similar problem to this myself and its all to do with how dates are handled in Veeam.

If you have a look in the task log file, you will see an entry similar to this: -
[29.07.2017 07:59:05] <15> Info [VeeamZIPRetention] Create, id 'GUID', retain days '08/05/2017 00:00:00',
As you can see, you have the date in the log file that the task started on 29.07.2017. My job was set to retain for 1 week which should mean it is retained until '05/08/2017'. What is recorded in the system for retention is '08/05/2017' which the system will see as being past it's retention date and will delete the file.

To prove this, I did another backup with a retention date of 1 month. The log file is as follows: -
[03.08.2017 16:47:39] <15> Info [VeeamZIPRetention] Create, id '5948ba75-32c5-40ce-97ae-2c9b38127311', retain days '09/03/2017 00:00:00'
This means that the backup will be detected on the system as being out of date as it's scheduled to be deleted on the 9th March 2017.

This is a bug in Veeam that needs to be logged with them.
amatthews
Lurker
Posts: 2
Liked: never
Joined: Aug 03, 2017 1:47 pm
Full Name: Andrew Matthews
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by amatthews »

proactis wrote:I have create a very simple powershell script as a test to backup for now but it seems to ignore the -AutoDelete and seems to delete the day after. Is there a way of seeing what veema has issued to the zip backup as retention policy

$VM = "Server1"
$BackupPath = "E:\backup\"
Start-VBRZip -Entity $VM -Folder $BackupPath -Compression 9 -AutoDelete In3Days
I saw a similar problem to this myself and I think it's to do with the way the retention date is recorded. If you look in the Task file for your backup, you will see a line similar to this: -
[29.07.2017 07:59:05] <15> Info [VeeamZIPRetention] Create, id '{GUID}', retain days '08/05/2017 00:00:00', repository id '00000000-0000-0000-0000-000000000000', target file '{File Name}'
As you can see, the retain days date is recorded in the format mm/dd/yyyy.

Overnight, the Service Backup process kicked in and deleted the file as it was past it's retention and was recorded in the log file as this: -
[30.07.2017 00:00:05] <30> Info [VeeamZIPRetention] Deleting file '{File Name}' on repository 'Local filesystem' because it's due is 08/05/2017 00:00:00
To prove my theory, I've just run a backup with a 1 month retention and the log file is shown as this: -
[03.08.2017 16:47:39] <15> Info [VeeamZIPRetention] Create, id '{GUID}', retain days '09/03/2017 00:00:00', repository id '00000000-0000-0000-0000-000000000000', target file '{File Name}'
The retain date has been recorded again in mm/dd/yyyy format instead of dd/mm/yyyy so I would expect the backup file to be deleted overnight as it's past it's expiry date.

I've logged this with Veeam - let's see what comes out of it.
r.castello
Influencer
Posts: 11
Liked: never
Joined: Jul 12, 2017 10:31 am
Full Name: Ruben
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by r.castello »

v.Eremin wrote:Everything is working fine except Retention, this is set to "Tonight" for testing and backups are not deleted.
Can you try to reproduce the issue via GUI and provide me with the results of your findings?
Hello Again v.Eremin,

I'm having issues another time with Retention Policy, I will show you an example.
Here's the script I use for multiple jobs with VeeamZip powershell script, as you can see in this case we are backing up a virtual machine called dnscache12 with a RetentionPolicy of 3 days.

Code: Select all

# Author: Vladimir Eremin
# Created Date: 3/24/2015
# http://forums.veeam.com/member31097.html
# 

##################################################################
#                   User Defined Variables
##################################################################

# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames = “VM1”,”VM2”
$VMNames = "dnscache12"

# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = "vcenter.XXXXXXXX"

# Directory that VM backups should go to (Mandatory; for instance, C:\Backup)
$Directory = "D:\VeeamBackup_vcenter5\dnscache"

# Desired compression level (Optional; Possible values: 0 - None, 4 - Dedupe-friendly, 5 - Optimal, 6 - High, 9 - Extreme) 
$CompressionLevel = "5"

# Quiesce VM when taking snapshot (Optional; VMware Tools are required; Possible values: $True/$False)
$EnableQuiescence = $True

# Protect resulting backup with encryption key (Optional; $True/$False)
$EnableEncryption = $False

# Encryption Key (Optional; path to a secure string)
$EncryptionKey = ""

# Retention settings (Optional; By default, VeeamZIP files are not removed and kept in the specified location for an indefinite period of time. 
# Possible values: Never , Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)
$Retention = "In3days"

##################################################################
#                   Notification Settings
##################################################################

# Enable notification (Optional)
$EnableNotification = $false

# Email SMTP server
$SMTPServer = ""

# Email FROM
$EmailFrom = "" 

# Email TO
$EmailTo = ""

# Email subject
$EmailSubject = "VeeamZip - dnscache"

##################################################################
#                   Email formatting 
##################################################################

$style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }"
$style = $style + "TD{border: 1px solid black; padding: 5px; }"
$style = $style + "</style>"

##################################################################
#                   End User Defined Variables
##################################################################

#################### DO NOT MODIFY PAST THIS LINE ################
Asnp VeeamPSSnapin

$Server = Get-VBRServer -name $HostName
$MesssagyBody = @()

foreach ($VMName in $VMNames)
{
  $VM = Find-VBRViEntity -Name $VMName -Server $Server
  
  If ($EnableEncryption)
  {
    $EncryptionKey = Add-VBREncryptionKey -Password (cat $EncryptionKey | ConvertTo-SecureString)
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention -EncryptionKey $EncryptionKey
  }
  
  Else 
  {
    $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
  }
  
  If ($EnableNotification) 
  {
    $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
    $FailedSessions =  $TaskSessions | where {$_.status -eq "EWarning" -or $_.Status -eq "EFailed"}
  
  if ($FailedSessions -ne $Null)
  {
    $MesssagyBody = $MesssagyBody + ($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
  {
    $MesssagyBody = $MesssagyBody + ($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)
{
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
$SMTP.Send($Message)
}

As you can see in the next code, is the event generated on windows Event log as backup is completed successfully, on Veeam Backup there is the same record.

Code: Select all

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Veeam Backup" /> 
  <EventID Qualifiers="0">0</EventID> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2017-08-03T18:02:01.000000000Z" /> 
  <EventRecordID>7415</EventRecordID> 
  <Channel>Veeam Backup</Channel> 
  <Computer>wingest01</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data>Session dnscache12_2017-08-03T200011 (Active Full) has been completed.</Data> 
  </EventData>
  </Event>
But a little bit later, just 4hours later and not 3 days as specified on RetentionPolicy backup is deleted!!

Code: Select all

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Veeam MP" /> 
  <EventID Qualifiers="0">10050</EventID> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2017-08-03T22:00:21.000000000Z" /> 
  <EventRecordID>7462</EventRecordID> 
  <Channel>Veeam Backup</Channel> 
  <Computer>wingest01</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data>14d5dd8c-ba2e-4dd4-bcce-5fbd424011a8</Data> 
  <Data>14d5dd8c-ba2e-4dd4-bcce-5fbd424011a8</Data> 
  <Data>vm-1795</Data> 
  <Data>dnscache12</Data> 
  <Data>vcenter.XXXXXXX</Data> 
  <Data>08/03/2017 22:00:21</Data> 
  <Data>False</Data> 
  <Data>0</Data> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data /> 
  <Data>1</Data> 
  <Data>Restore point for VM 'dnscache12' has been removed according to the configured retention policy.</Data> 
  </EventData>
  </Event>
Any ideas on what's happening?
Something that it's strange for me is that folder "$Directory = "D:\VeeamBackup_vcenter5\dnscache"" is gone, "dnscache" folder does not exist anymore. So maybe retention policy is deleting old backup(>3days) but it wipes all the folder with the new ones.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

The best course of action is the following:

- Try to apply the retention period via GUI
- If the issue is reproduced, log a support ticket
- Post the case its number here, and we will follow the case

Thanks.
manticore01
Lurker
Posts: 1
Liked: never
Joined: Aug 07, 2017 12:44 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by manticore01 »

Hi All,

Was writing this post as i could not work out what was going wrong, as i got to the end it all clicked. I thought id still post this for anyone else that may get stumped before the coffee kicks in.

I could not pass the -NetworkCredentials parameter in the way the documentation states. "Get-VBRCredentials" was returning a string array which isnt passable to Start-VBR as it expects CCredentials type.

Code: Select all

$VM = Find-VBRViEntity -Name $VMName -Server $Server
$netcreds = Get-VBRCredentials -Name "test"

$ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention  -NetworkCredentials $netcreds
The above code gave me the following error:

Start-VBRZip : Cannot convert 'System.Object[]' to the type 'Veeam.Backup.Common.CCredentials' required by parameter 'NetworkCredentials'. Specified method is not supported.

Turns out, if you have multiple credentials with the same username, it falls apart as Get-VBRCredentials return a list of them rather than the CCredential type.
I had a standard credential, and also a linux credential with the same username (as VBR made me create a different one for use with a Linux file store).

So for anyone that searches the above error message i originally got, they should hopefully find this.

Quick additional note, I had looked at the documentation https://helpcenter.veeam.com/docs/backu ... brzip.html and couldnt see anything different. It may also be worth noting on that page theres a typo in the very last code snippet (theres a & instead of an $) NetworkCredentials &netcreds -RunAsync.

Thanks all!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Thank you, the information has been passed to technical writers already.
m.lazzarotto
Lurker
Posts: 1
Liked: never
Joined: Aug 22, 2017 12:40 pm
Full Name: Marco Lazzarotto
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by m.lazzarotto »

Hi, I just discovered the script, but still I don't understand how to pass the username and password to the -NetworkCredential parameter of the script.
Is it possibile to give the password in clear text in the script? Could please someone make me an example on how to do it?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Add credentials to backup server first, then, refer to them, using Get-VBRCredentials cmdlet. Check the example at the bottom of the page. Thanks.
r.castello
Influencer
Posts: 11
Liked: never
Joined: Jul 12, 2017 10:31 am
Full Name: Ruben
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by r.castello »

Hi Any updated on your case with Veeam?
Can you help me to find those logs file and check my environment? Can you tell me the path?

Thanks,
r.castello
Influencer
Posts: 11
Liked: never
Joined: Jul 12, 2017 10:31 am
Full Name: Ruben
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by r.castello »

Found the logs and I am affected with the same issue:

Code: Select all

[30.08.2017 20:00:43] <25> Info     [VeeamZIPRetention] Create, id 'XXXXXXXX', retain days '09/02/2017 0:00:00', repository id '00000000-0000-0000-0000-000000000000', target file 'D:\VeeamBackup_vcenter5\dnscache\XXXXXXXD2017-08-30T200028.vbk'
This machine was scheduled to backup with a retention of 3 days, but due to this "bug?" with the date, is deleted in the same night. Seems a problem with the format of the dates?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Have you already done that?
v.Eremin wrote:The best course of action is the following:

- Try to apply the retention period via GUI
- If the issue is reproduced, log a support ticket
- Post the case its number here, and we will follow the case

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

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

UPDATE: the given problem with retention policy should be fixed in Update 3. Thanks guys for actively raising this issue, your participation allowed us to identify the root cause of the problem and react accordingly; much appreciated.
peawet08
Novice
Posts: 6
Liked: never
Joined: Jan 11, 2016 12:19 pm
Full Name: Mark Sammon
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by peawet08 »

Hi,

I have just upgraded to 9.5 Update 2.

We have a simple script that backs up multiple VM's using Start-VBRzip in the free edition. Whilst we had the retention policy set to -In3Days it never actually worked.
find-vbrhventity -Name "<machinename>" | where {$_.PowerState -eq "PoweredOn"} | Start-VBRZip -folder "D:\VeeamBackup" -Compression 6 -AutoDelete In3Days

Now in the latest version, I start my backups at 19:00 and they run until about 07:00 the following day. However at midnight each day, the backups done before midnight are all deleted.

An event in the event log states "Restore point for VM '<machinename>' has been removed according to the configured retention policy."

Does anybody know why it would suddenly have started deleting the backups from the previous night?

Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests