VMware Cloud Community
AlexAckerman
Enthusiast
Enthusiast
Jump to solution

To Invoke or New-?

Hello,

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?

Thanks!

Ack

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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.


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

View solution in original post

1 Reply
LucD
Leadership
Leadership
Jump to solution

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.


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