View Only
  • 1.  To Invoke or New-?

    Posted Sep 16, 2022 12:51 PM


    I'm just starting out with scripting PowerShell for VMware products and I'm seeing some duplication in some of the calls.  I figured I'd rather try and get a start in the "preferred" direction rather than learning bad habits. 

    To that end, I see there are a couple ways to create a new VM in PowerCLI.  One is to call the New-VM commandlet and the other is to Initialize and specification and then call the Invoke-CreateVM call.  The later two use the REST API and I imagine the New-VM call leverages these in the backend.  But which is the preferred way we should do it in our scripts?



  • 2.  RE: To Invoke or New-?
    Best Answer

    Posted Sep 16, 2022 03:42 PM

    That series of Invoke- cmdlets are new and are based on the REST API.
    The New- cmdlets are based on the SOAP API.

    The overlap is not 100%.
    For some features you will have to use the SOAP based cmdlets, for (newer) features you will have to look at the Invoke- style cmdlets.