PowerShell script exchange
Post Reply
jivebutterball
Lurker
Posts: 1
Liked: never
Joined: Sep 01, 2015 8:24 pm
Contact:

Pulling vm names from text file

Post by jivebutterball » 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?

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

Re: Pulling vm names from text file

Post by veremin » 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.

jbilt2
Novice
Posts: 3
Liked: never
Joined: Sep 24, 2015 1:15 pm
Contact:

Re: Pulling vm names from text file

Post by jbilt2 » 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.

tdewin
Veeam Software
Posts: 1404
Liked: 458 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Pulling vm names from text file

Post by tdewin » 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests