PowerCLI and the SDK – Part 1

In the Developer forum there was an interesting post called Resources for folks new to the vSphere Web Services SDK. Now unfortunately the Hello World guide was (again) only aimed at Java programmers.

Although PowerCLI is nearing perfection, you sometimes will have to go to the SDK methods and properties to make your script go that extra mile. Since I know, from first-hand experience, that the first steps in the SDK are not that simple for PowerShell programmers/scripters I decided to start a series to make the SDK more accessible for the PS people.

The first entry in the series is a simple one. It will take the Java sample form the above mentioned document and show you how to do the same thing in PS.

Make sure that you first read the Hello World document since it explains some key concepts on SDK programming.

Notice how simple the PS script is compared to the Java sample in the document. The major reason for this is that the PowerCLI Team did a marvelous job in predicting what you and I would need and packaged a lot of the dreary stuff in their cmdlets.

Annotations

Line 4 : this is where you connect to the web service port and establish a session

Line 12: call the CurrentTime method. Notice the difference how SDK methods are called and how the parameters are passed. In this case the empty parenthesis indicate there are no parameters passed.

Like I said, a small sample. But it contains some key concepts for using the vSphere Web Services SDK. And it shows how a lot of the hard work was already done for us by the PowerCLI Team.

2 Comments

    Pablo

    Luc – thanks for the mention and comments. I will bring back your comments about Java only to the author of the Hello World Doc – Balaji . Balaji seems to have a preference for Java 😉 although he does have Hals book on his desk 😉 secretly placed by the Powershell fairies.. 🙂

      LucD

      Thanks Pablo and thanks to the PowerShell fairies inside VMW.

      It will take some time to get rid of this mental image of the fairy though 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.