Automation

 View Only
  • 1.  Is it possible to convert a VM into a Template?

    Posted Dec 03, 2008 11:30 PM

    With the Set-Template it is possible to convert a Template into VM by including parameter -ToVM.

    You should expect something simmular in Set-VM by having a parameter like -ToTemplate, but that is not true. So far, it looks like it is only possible to create a template based on a VM, using New-Template

    I have been digging on every (relevant) cmdlet, but it looks like it is not supported.

    Any suggestions on how to do this?

    Frank



  • 2.  RE: Is it possible to convert a VM into a Template?

    Posted Dec 04, 2008 03:28 AM

    It's pretty easy but not obvious. You have to dip into the SDK a little bit. I agree, there should be a parameter on Set-VM to do this.

    Here's how to mark a VM as a template, and a little more besides: http://halr9000.com/article/591






    [PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator

    Author of the upcoming book: Managing VMware Infrastructure with PowerShell

    Co-Host, PowerScripting Podcast (http://powerscripting.net)

    Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org



  • 3.  RE: Is it possible to convert a VM into a Template?

    Posted Dec 04, 2008 09:35 AM

    Thanks Hal.

    this is the missing part.

    Frank



  • 4.  RE: Is it possible to convert a VM into a Template?

    Posted Dec 04, 2008 04:25 AM

    Hi,

    Please refer the below script to convert a VM into a template.

    Connect-viserver -server

    $vm = Get-VM "VMName" | Get-View

    $vm.MarkAsTemplate()

    Thanks

    Niket