VMware Cloud Community
andreaspa
Hot Shot
Hot Shot
Jump to solution

Ignore warnings on OVF properties when deploying from content library

Hi,

I've written a script that deploys multiple VMs from a content library item, but I would like to clean up the script output.

I'm using this command to deploy VMs:

 

Get-ContentLibraryItem <item> | New-VM -Name <name> -Datastore <datastore> -DiskStorageFormat Thin -VMHost <esx> -Location <folder> | Out-Null

 

Since I have a few extra config options set, I get this warning:

andreaspa_0-1681302723392.png

Is it possible to hide this output?

EDIT: Clarified the question

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could try with

$WarningPreference = 'SilentlyContinue'

just before that line.
Don't forget to set it back to 'Continue", which should be the default setting


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

7 Replies
Lalegre
Virtuoso
Virtuoso
Jump to solution

@andreaspa,

Yes, this is just a warning about the extra configurations, you can safely ignore it. There is a thread here also facing the same but by using GUI: https://communities.vmware.com/t5/VMware-vSphere-Discussions/Failed-Deploy-VM-from-Content-Library/t...

Reply
0 Kudos
andreaspa
Hot Shot
Hot Shot
Jump to solution

It seems I was a bit unclear, I was wondering if there was a setting to get rid of the output for this warning, not whether it was safe to ignore it or now 🙂

I'm updating the original post to clarify, thanks for the reply!

Reply
0 Kudos
Lalegre
Virtuoso
Virtuoso
Jump to solution

@andreaspa,

Oh sorry I misunderstood the question, I do not know to be honest if it can be removed.

Sorry again 😞

Reply
0 Kudos
andreaspa
Hot Shot
Hot Shot
Jump to solution

No worries, it was me who wasn't clear enough in the question, so I've updated it 🙂
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could try with

$WarningPreference = 'SilentlyContinue'

just before that line.
Don't forget to set it back to 'Continue", which should be the default setting


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

andreaspa
Hot Shot
Hot Shot
Jump to solution

Hmm, is that equivalent to "-WarningAction SilentlyContinue" as a common parameter?

I'll experiment with both, and get back with feedback! Thanks @LucD!
Reply
0 Kudos
andreaspa
Hot Shot
Hot Shot
Jump to solution

It was sufficient to use this as a common parameter to the command. 

-WarningAction SilentlyContinue

I'm happy, thanks @LucD !

Reply
0 Kudos