PowerShell script exchange
Post Reply
dtraube
Novice
Posts: 4
Liked: 1 time
Joined: Mar 04, 2016 1:14 am
Full Name: Dave Traube
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by dtraube »

Vitaliy S. wrote: Unfortunately, currently it is not supported, however you can try to grant access to this share for Veeam backup service account, might do the trick.
We are using the local system account for the Veeam service. Do we need to reinstall to change the account that it is using?

Vitaliy S.
Product Manager
Posts: 25035
Liked: 2133 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Vitaliy S. »

No, you don't need to re-install the produce, you can change service account via Services MMC snap-in. Before doing this, make sure that your new account meets these requirements.

Vitaliy S.
Product Manager
Posts: 25035
Liked: 2133 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Vitaliy S. »

buldev wrote:with run as , with windows task manager logged user same effect.
I'm on a VM with admin domain account.
Ok, if it works via GUI and doesn't work via scheduling, then it's better let our support team take a look at this issue live.

buldev
Novice
Posts: 5
Liked: never
Joined: Mar 09, 2016 2:24 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by buldev »

hello thank you for your answers

It's ok now it was a problem with the access with the NAS, the message of dtraube help me.

So I save in local disk and after to the NAS ...

Thk it's ok for me now

Vitaliy S.
Product Manager
Posts: 25035
Liked: 2133 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Vitaliy S. »

Oh, ok! I though that you have this error message while processing VMs. If there is a problem with accessing NAS device, try the workaround I have suggested above, might do the trick.

buldev
Novice
Posts: 5
Liked: never
Joined: Mar 09, 2016 2:24 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by buldev »

yes it was a message like "Processing VM ... error" and if i change the destination of the VeeamZIP (from the NAS to a local disk) work fine .

I'll try the workaround you suggest

dtraube
Novice
Posts: 4
Liked: 1 time
Joined: Mar 04, 2016 1:14 am
Full Name: Dave Traube
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by dtraube »

Vitaliy S. wrote:No, you don't need to re-install the produce, you can change service account via Services MMC snap-in. Before doing this, make sure that your new account meets these requirements.
I created a new Veeam domain user and made it a local admin on the server. I added it as a Read/Write user on the NAS. I am seeing the following error when I execute script:

3/14/2016 4:17:17 PM :: Error: Access is denied.
--tr:Error code: 0x00000005
Cannot create folder. Folder path: [\\myNAS\Veeam].
--tr:FC: Failed to create directory. Directory path: [\\myNAS\Veeam].
--tr:Failed to call DoRpc. CmdName: [FcCreateDir].
Access is denied.
Cannot create folder. Folder path: [\\MyNas\Veeam].

utilizard
Novice
Posts: 3
Liked: never
Joined: Mar 03, 2016 6:19 am
Full Name: Alexander
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by utilizard »

I backup all my vms to network share successfully . I gave full network and ntfs access for domain admin and start Veeam Data Mover Service (VeeamTransportSvc) as domain admin. All work fine.
But I found out that I should give full access for another process to delete old backups. I don't know which...((( Because of this i gave full access for everybody. )))) It's not secure, but now VBR can delete old backups.

Vitaliy S.
Product Manager
Posts: 25035
Liked: 2133 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Vitaliy S. »

Dave, can you please try to follow Alexander's suggestion and post back us the results?

dtraube
Novice
Posts: 4
Liked: 1 time
Joined: Mar 04, 2016 1:14 am
Full Name: Dave Traube
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by dtraube » 1 person likes this post

I set all Veeam services to use the Veeam service account. I was then able to run the script. Thank you for your help.

oursgris
Lurker
Posts: 2
Liked: 2 times
Joined: Mar 16, 2016 12:32 pm
Full Name: philippe

Re: Start-VBRZip in Veeam Backup Free Edition

Post by oursgris » 2 people like this post

hello
that's a wunderful tool

we should have the hability to use SMTP with auth (or with TLS)
I add this, you can integrate it with your code

$SMTP.EnableSsl = $true
$SMTP.Credentials = New-Object System.Net.NetworkCredential("email", "password");

I think we shouldn't have notification in case of everything is fine
I modified that line :
If ($EnableNotification -and -not $MesssagyBody -eq "")

oursgris
Lurker
Posts: 2
Liked: 2 times
Joined: Mar 16, 2016 12:32 pm
Full Name: philippe

Re: Start-VBRZip in Veeam Backup Free Edition

Post by oursgris »

hello
i've a problem with backup
i run the script with elevated privilege

When I use $EnableQuiescence = $True, it works
but the web server is down
I had to reboot the server

when I use $EnableQuiescence = $False, it doesn't work

Backup job session
Job 'rch_2016-03-17T085104' '0' of '0' bytes processed, object '0' of '0'
[ ]
Il reste 00:00:00.

Files remaining\total: 0,0 KB; Avg. rate: 0 KB/s



Is it possible to reboot the VM automatically after the save or do you have a tip to make it work ?

utilizard
Novice
Posts: 3
Liked: never
Joined: Mar 03, 2016 6:19 am
Full Name: Alexander
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by utilizard »

I think It's impossible to backup running VM with $EnableQuiescence = $False. Stop your VM and try to use script with $EnableQuiescence = $False.

Vitaliy S.
Product Manager
Posts: 25035
Liked: 2133 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Vitaliy S. »

oursgris wrote:i've a problem with backup
i run the script with elevated privilege
....
Is it possible to reboot the VM automatically after the save or do you have a tip to make it work ?
You don't need to reboot a VM, cause backup job can back up a running VM. What do you mean the web server is down? What happens if you create a VM snapshot with VMware Tools Quiescence option enabled? Do you see the same behavior? Finally, are you able to create a VeeamZIP job for this VM using Veeam Backup FREE UI?
utilizard wrote:I think It's impossible to backup running VM with $EnableQuiescence = $False. Stop your VM and try to use script with $EnableQuiescence = $False.
Sure you can backup any VM without VMware Tools Quiescence option. This option is used to have a consistency within the guest OS when creating a VM snapshot.

bostjanc
Influencer
Posts: 15
Liked: 2 times
Joined: Apr 16, 2015 8:24 am
Full Name: bostjanc
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by bostjanc »

Upgraded Veeam backup and replication server from 8 (update 3) to version 9.
After upgrade we are unable to create backups thru powershell, although thru GUI we are able to make backup of hyperv.

Code: Select all

ERRORS:
Find-VBRHvEntity : Unable to find assembly 'Veeam.Backup.HVLib

Find-VBRHvEntity : Unable to find assembly 'Veeam.Backup.HVLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bfd684
de2276783a'.
At C:\scripts\Backup-Virtual-Machines-On-HypervOBIWAN.ps1:78 char:25
+ $VM = Find-VBRHVEntity <<<< -Name $VMName -Server $Server
 + CategoryInfo : NotSpecified: (:) [Find-VBRHvEntity], SerializationException
 + FullyQualifiedErrorId : System.Runtime.Serialization.SerializationException,Veeam.Backup.PowerShell.Command.Find
 VBRHvEntity

Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Supply a non-null argument and try
 the command again.
At C:\scripts\Backup-Virtual-Machines-On-HypervOBIWAN.ps1:88 char:39
+ $ZIPSession = Start-VBRZip -Entity <<<< $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!
$EnableQuiescence) -AutoDelete $Retention
 + CategoryInfo : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
 + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip

bostjanc
Influencer
Posts: 15
Liked: 2 times
Joined: Apr 16, 2015 8:24 am
Full Name: bostjanc
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by bostjanc » 1 person likes this post

It was powershell version problem.
Veeam 9 installed on 2008 r2 with powershell version 2.
After upgrading it to powershell version 4, solved the issue

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

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Great. We've updated the blog post with much needed note. Hopefully, it would allow users planning to work with this script to avoid strange issues:
4-April 2016 Note: Update your PowerShell to version 3.0 at least prior to using this script, as we’ve discovered number of odd issues while working with PowerShell 2.0.
Thanks.

alexgaluszka
Novice
Posts: 4
Liked: never
Joined: Apr 07, 2016 1:45 pm
Full Name: Alexandre Galuszka
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by alexgaluszka »

I would like to make my backup on another computer, this one is not in the domain, to do my tests but it does not work.

Can you help me?

Code: Select all

# Names of VMs to backup separated by semicolon (Mandatory)
$VMNames = "monserveurasauvegarder"

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

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

alexgaluszka
Novice
Posts: 4
Liked: never
Joined: Apr 07, 2016 1:45 pm
Full Name: Alexandre Galuszka
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by alexgaluszka »

There's nobody can help me ? :(

veremin
Product Manager
Posts: 18561
Liked: 1852 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 answers provided above should give you some hints. The first things to check are:

1) Veeam account read/write permissions on the given share
2) Computer account read/write permissions on the given share

Thanks.

alexgaluszka
Novice
Posts: 4
Liked: never
Joined: Apr 07, 2016 1:45 pm
Full Name: Alexandre Galuszka
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by alexgaluszka »

thanks :)

but I am novice in script thus I am lost to code it

sorry for my bad English ^^'

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

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Being ordinary Windows actions, they don't require scripting. Thanks.

alexgaluszka
Novice
Posts: 4
Liked: never
Joined: Apr 07, 2016 1:45 pm
Full Name: Alexandre Galuszka
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by alexgaluszka »

ok, thanks

Dax_UK
Lurker
Posts: 2
Liked: never
Joined: Apr 15, 2016 8:53 am
Full Name: David Wells
Contact:

[MERGED] : Start-VBRZIP issue after upgrade to v9

Post by Dax_UK »

Hi,

Just upgraded our B&R to v9 and started having an issue with Start-VBRZip it is now saying Error: Value cannot be null. Parameter name: source.

Im using the following Script, and all was working fine until upgrade, I have tried the fix listed to create snapshot and delete it made no difference.

ANy Help would be greatly appreciated
Dax

Code: Select all

Param(
  [Parameter(Mandatory=$true)][string]$VM,
  [Parameter(Mandatory=$true)][string]$Destination,
  [Parameter(Mandatory=$true)][ValidateSet(0,4,5,6,9)][int]$Compression,
  [bool]$DisableQuiesce=$true,
  [Parameter(Mandatory=$true)][ValidateSet("Never","Tonight","TomorrowNight","In3days","In1Week","In2Weeks","In1Month")][string]$Autodelete
)

#Load Veeam Toolkit
& "C:\Program Files\Veeam\Backup and Replication\Backup\Initialize-VeeamToolkit.ps1"
#Validate any parameters
$vmentity = Find-VBRViEntity -Name $VM
if ($vm -eq $null)
{
  Write-Host "VM: $VM not found" -ForegroundColor "red"
  exit
}
#if (-Not (Test-Path $Destination))
#{
#  Write-Host "Destination: $vmname not valid" -ForegroundColor "red"
#  exit
#}
if ($DisableQuiesce -eq $true)
{
    Start-VBRZip -Entity $vmentity -BackupRepository $destination -Compression $Compression -AutoDelete $Autodelete -DisableQuiesce
}
else
{
    Start-VBRZip -Entity $vmentity -BackupRepository $destination -Compression $Compression -AutoDelete $Autodelete
}

veremin
Product Manager
Posts: 18561
Liked: 1852 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, David, aren't you using free edition by any chance? If so, check this discussion. Thanks.

Dax_UK
Lurker
Posts: 2
Liked: never
Joined: Apr 15, 2016 8:53 am
Full Name: David Wells
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Dax_UK »

Yes that is my issue, that's a shame

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

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Just re-write a script, so that, it uses a folder instead of repository. After this modification, it should work flawlessly. Thanks.

BluMonster
Lurker
Posts: 1
Liked: never
Joined: Apr 25, 2016 11:49 pm
Full Name: X X

[MERGED] : VeeamZIP Powershell - Simultaneous VM Backups?

Post by BluMonster »

Hi,

Im using the following powershell script with the lastest Free version of Veeam Backup:
https://www.veeam.com/blog/veeam-backup ... shell.html

I was wondering if there is a way to specify the amount of Simultaneous backups to run?
If i manually via the GUI start full VM backups i can start multiple backups running at the same time but im not sure how to do this via powershell.
At the moment via powershell my VMs get backed up one at a time, I.E $VMNames = "VM1","VM2","VM3"

Is there a way via powershell to have 2 Simultaneous VMs be backed up?

Thanks

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

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

From the top of my head, you need to add -RunAsync switch to the lines containing Start-VBRZip command. Thanks.

ice2921
Novice
Posts: 3
Liked: 1 time
Joined: Apr 26, 2016 6:33 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by ice2921 »

Hello I am receiving the following errors when trying to run this for hyper-v. I'm not too concerned about the email portion failing, but it seems as though its looking for a variable that is not there. Running B&R 9.0 thanks for any help.

Code: Select all

PS C:\Users\user.HOST03\Documents> .\VeeamBackup.ps1
Find-VBRViEntity : Object reference not set to an instance of an object.
At C:\Users\user.HOST03\Documents\VeeamBackup.ps1:76 char:9
+   $VM = Find-VBRViEntity -Name $VMName -Server $Server
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Find-VBRViEntity], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Veeam.Backup.PowerShell.Command.FindVBRViEntity

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 C:\Users\user.HOST03\Documents\VeeamBackup.ps1:86 char:40
+     $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+                                        ~~~
    + CategoryInfo          : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip

You cannot call a method on a null-valued expression.
At C:\Users\user.HOST03\Documents\VeeamBackup.ps1:91 char:5
+     $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "Send" with "1" argument(s): "Failure sending mail."
At C:\Users\user.HOST03\Documents\VeeamBackup.ps1:113 char:1
+ $SMTP.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException

PS C:\Users\user.HOST03\Documents>

Post Reply

Who is online

Users browsing this forum: soncscy and 4 guests