Pulling vm names from text file

PowerShell script exchange

Pulling vm names from text file

Veeam Logoby jivebutterball » Tue Sep 01, 2015 8:31 pm

Hey all, I'm trying to write a script where Veeam pulls a list of vm names, which I want to be backed up and deleted, from a text file. It is pulling the data but complains that it is in string format.

"Start-VBRZip : Cannot bind parameter 'Entity'. Cannot convert the "Name of my vm" value of type "System.String" to type
"Veeam.Backup.Common.IItem"

How do I change this into a something Veeam will recognize?
jivebutterball
Lurker
 
Posts: 1
Liked: never
Joined: Tue Sep 01, 2015 8:24 pm

Re: Pulling vm names from text file

Veeam Logoby v.Eremin » Wed Sep 02, 2015 9:44 am

Entity parameter accepts virtual infrastructure object, not just a VM name. Thus, the error. In order to find VM object you should use either Find-VBRViEntity or Find-VBRHvEntity commandlet (based on used platform). Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Pulling vm names from text file

Veeam Logoby jbilt2 » Thu Sep 24, 2015 1:43 pm

Greetings,
I find myself in the same situation as the original poster. I was initially attempting to pass VM names from a text file, now I'm attempting to use Find-VBRHvEntity as v.Eremin recommends. When I use this cmdlet however I receive the following error:

Cannot bind parameter 'Entity'. Cannot convert the "Veeam.Backup.Core.Infrastructure.CHvVmItem" value of type
"System.String" to type "Veeam.Backup.Common.IItem".

Here's my 2-liner:

Code: Select all
$vm = Find-VBRHvEntity -Name "VMname"
#Start-VBRZip -Folder .\backups\ -Entity "$vm" -Compression 4  -RunAsync -EncryptionKey $enckey -AutoDelete Never


Any assistance will be appreciated.
jbilt2
Novice
 
Posts: 3
Liked: never
Joined: Thu Sep 24, 2015 1:15 pm

Re: Pulling vm names from text file

Veeam Logoby tdewin » Fri Sep 25, 2015 7:56 am 1 person likes this post

my first thought, don't put quotes around $vm e.g. -Entity $vm

By adding quotes you try to make into a string, and really it is just an object.
tdewin
Veeam Software
 
Posts: 1046
Liked: 361 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests