Problem with PowerShell script/Veeam

PowerShell script exchange

Re: Problem with PowerShell script/Veeam

Veeam Logoby KGray2k16 » Tue Mar 15, 2016 12:29 pm

Sure understand, I did mention that it has worked successfully for the VM's individually although I have done as requested:

I enter:

Code: Select all
$VMNames = "LTBCC2L"

$HostName = "RDVirtual1"

foreach ($VMNames in $HostName)
{
  $VM = Find-VBRViEntity -Name $VMName -Server $Server
 Write-Output $VM
}


And get:

Code: Select all
ConnHostId : 76aa9244-10de-4427-9531-b013935f6e79
ConnHost   : Veeam.Backup.Core.Common.CHost
Type       : Esx
Reference  : ha-host
Id         : 76aa9244-10de-4427-9531-b013935f6e79_ha-host
Name       : RDVirtual1
Path       : RDVirtual1


I then tried this:

$VMNames = "LTBCC2L2"

$HostName = "RDVirtual1"

foreach ($VMNames in $HostName)
{
$VM = Find-VBRViEntity -Name $VMName -Server $Server
Write-Output $VM
}

And get:

Code: Select all
ConnHostId : 76aa9244-10de-4427-9531-b013935f6e79
ConnHost   : Veeam.Backup.Core.Common.CHost
Type       : Esx
Reference  : ha-host
Id         : 76aa9244-10de-4427-9531-b013935f6e79_ha-host
Name       : RDVirtual1
Path       : RDVirtual1
KGray2k16
Influencer
 
Posts: 10
Liked: 1 time
Joined: Tue Mar 15, 2016 9:45 am
Full Name: Kristian Gray

Re: Problem with PowerShell script/Veeam

Veeam Logoby KGray2k16 » Tue Mar 15, 2016 12:45 pm 1 person likes this post

Okay I just found this on your other page:

$VMNames = "VM1", "VM2", "VM3"

Have tried this as follows with my VM names and the script seems to be running okay. I will obviously have to wait until its finished to be sure but looks like it might be okay now.

Thanks for your help thus far, with any luck this may be the answer.
KGray2k16
Influencer
 
Posts: 10
Liked: 1 time
Joined: Tue Mar 15, 2016 9:45 am
Full Name: Kristian Gray

Re: Problem with PowerShell script/Veeam

Veeam Logoby PTide » Tue Mar 15, 2016 12:51 pm

Good! I've just found out that too. Also you can even omit the foreach if you want:
This will VeeamZip both VM1 and VM2:
Code: Select all
$VMNames = "VM1","VM2"
$HostName = "vcenter.local"
$Server = Get-VBRServer -name $HostName
$Directory = "E:\Backup"
$VMS=Find-VBRViEntity -Name $VMNames -Server $Server
$ZIPSession = Start-VBRZip -Entity $VMS -Folder $Directory


Thank you!
PTide
Veeam Software
 
Posts: 3019
Liked: 246 times
Joined: Tue May 19, 2015 1:46 pm

Re: Problem with PowerShell script/Veeam

Veeam Logoby v.Eremin » Mon Mar 21, 2016 12:42 pm

If Free Edition is in place, usage of foreach is still required, as you cannot VeeamZIP multiple VMs in VB&R Free Edition. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 969 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 7 guests