VMware Cloud Community
RyanMcL
Enthusiast
Enthusiast
Jump to solution

disable vapp options powercli

I can't seem to find a method in the SDK / get-view to disable the vapp options of a VM that was imported via OVF/OVA.

The GUI method is Select a VM -> edit settings -> options -> vapp options -> disable.

Anyone know of such a method?

Ryan

Reply
0 Kudos
1 Solution

Accepted Solutions
Zsoldier
Expert
Expert
Jump to solution

Here ya go:

#Use this to disable the vApp functionality.

$disablespec = New-Object VMware.Vim.VirtualMachineConfigSpec

$disablespec.vAppConfigRemoved = $True

#Use this to enable

$enablespec = New-Object VMware.Vim.VirtualMachineConfigSpec

$enablespec.vAppConfig = New-Object VMware.Vim.VmConfigSpec

#Get the VM you want to work against.

$VM = Get-VM NameofVM | Get-View

#Disables vApp Options

$VM.ReconfigVM($disablespec)

#Enables vApp Options

$VM.ReconfigVM($enablespec)

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier

View solution in original post

Reply
0 Kudos
3 Replies
Zsoldier
Expert
Expert
Jump to solution

Here ya go:

#Use this to disable the vApp functionality.

$disablespec = New-Object VMware.Vim.VirtualMachineConfigSpec

$disablespec.vAppConfigRemoved = $True

#Use this to enable

$enablespec = New-Object VMware.Vim.VirtualMachineConfigSpec

$enablespec.vAppConfig = New-Object VMware.Vim.VmConfigSpec

#Get the VM you want to work against.

$VM = Get-VM NameofVM | Get-View

#Disables vApp Options

$VM.ReconfigVM($disablespec)

#Enables vApp Options

$VM.ReconfigVM($enablespec)

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
Reply
0 Kudos
RyanMcL
Enthusiast
Enthusiast
Jump to solution

Thanks,

Per chance you can point me towards documentation which would have pointed me torwards this solution?

Regards,

Ryan

Reply
0 Kudos
Zsoldier
Expert
Expert
Jump to solution

Great Cheat Tool:

Project Onyx: http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/onyx?rct=j&q=project%252...

Otherwise, lots of trial and error looking up in vSphere API Reference.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
Reply
0 Kudos