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 »

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: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Pulling vm names from text file

Post by veremin »

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 »

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: 1818
Liked: 655 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Pulling vm names from text file

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