Home > Blogs > VMware PowerCLI Blog > Tag Archives: Fling

Tag Archives: Fling

Introducing Code Capture

I am extremely excited to announce a new feature that’s been added to the vSphere HTML5 Web Client Fling. This new feature is called Code Capture. While the name might not sound familiar, hopefully you’re already acquainted with its predecessor – Onyx, which is currently the most requested feature on the PowerCLI Feature Requests site!

PowerCLI Feature Requests Site - Most Popular

Code Capture gives you the ability to take actions you’ve completed in the vSphere Client and outputs usable code. Once you have the vSphere HTML5 Web Client Fling installed, it’s just as simple as hitting the red ‘record’ button on the top menu, performing your activities, then hitting the red ‘stop’ button. At this point, you’ll be taken to the Code Capture section where you can browse your code and even copy or download the code as well!

Before jumping to download the fling, we should discuss what a VMware Fling really is. Flings are projects that are built by our engineers and made available for general consumption. These flings are distributed under the Technical Preview License and, therefore, are recommended to not be run on production environments. This also means there is no ability to open a VMware support request. However, you can open a bug against the fling itself using the ‘Bugs‘ tab. Also, I would like to point out the ‘Comments‘ tab where you can submit feedback. We would greatly appreciate any and all feedback you have!

Now, let’s checkout Code Capture!

Code Capture in Action

Code Capture In Action

Now let’s take a more in-depth look.

Code Capture Output

In the example above, we can see that we are shutting down a system by the name of ‘app01’. Once we click on the ‘stop’ button, it shows us the PowerCLI.NET code. This is important because, at first glance, the output may not be quite as you expect.

For example, you may have expected to see a command like Shutdown-VMGuest -Name app01 Instead, we saw low-level PowerCLI calls. Walking through the code, it created a VirtualMachine object, which referenced the app01 VM by MoRef, followed by the usage of a method named ‘ShutdownGuest’ that is called directly against the VM object. More information about this specific method: ShutdownGuest()

Code Output:

It’s worth noting, at this point in time, all of the returned code is going to be in this manner. There are on-going investigations to add the translation from this code into high-level PowerCLI cmdlets. If this type of conversion is important to you, please add a comment to the following PowerCLI Feature Request: Onyx support for HTML5 and REST APIs

Using the Output

If I were to power on the app01 VM, I could then use the code in a PowerShell session (where I’m already connected to the vCenter Server) to shutdown the app01 system. To make this easier, Code Capture includes a ‘Copy’ button which easily copies the entirety of the code to our clipboard. We can now paste this into our PowerShell session to accomplish the task!

Example:
Code Capture Copy Paste Output

Another option to extract the code from our browser is with the ‘Download’ button. Clicking ‘Download’ will, depending on your browser configuration, save a file named ‘power-cli-script.ps1’ to your Downloads folder. We can then call that file just like any script from our PowerShell session to accomplish the action.

Example:
Code Capture Using Downloaded Script

Summary

The next generation of Onyx is here and it’s called Code Capture, which is only available in the vSphere HTML5 Web Client Fling! Using the start and stop button on the main menu bar, Code Capture allows you to take your actions in the vSphere Client and output them to PowerCLI code. The code output can also easily be copied and/or downloaded from your browser session using the dedicated buttons in the Code Capture area.

Get started by heading over to the vSphere HTML5 Web Client Fling page and downloading the latest version today!

New Release: PowerCLI Preview for VMware NSX-T Fling

A new Fling has been released for PowerCLI! The PowerCLI Preview for NSX-T Fling adds 280 high-level cmdlets which operate alongside the existing NSX-T PowerCLI module.

What do I mean by ‘high-level’ cmdlets? There are generally two forms of cmdlets available through PowerCLI, high-level and low-level. High-level cmdlets abstract the underlying API calls and provide an easy to use and understand cmdlet, like Get-LogicalSwitch. Based on that, you can assume the output will be logical switches. However, every API call does not have a corresponding high-level cmdlet and that’s where the low-level cmdlets come into play. Low-level cmdlets interact directly with the API and therefore have complete coverage of the available API calls. An example of a low-level cmdlet would be Get-View, or in the case of the NSX-T module it would be Get-NsxtService. More information about the low-level cmdlet usage of the NSX-T module is available in the following blog post: Getting Started with the PowerCLI Module for VMware NSX-T

Why is this being released as a fling? This module is still being developed and we need your feedback! What cmdlets are you using the most? What should the output look like? What cmdlets aren’t working the way you think they should? What cmdlets are missing? As well as any other feedback you can come up with! The preference is to leave the feedback on the fling’s comments section. However, if you post it as a comment here, I’ll make sure the right people receive it.

With that said, let’s get started using this new module!

Geting Started

First, we’ll need to head out to the VMware Flings site, browse for the fling and download the zip file. Direct link: PowerCLI Preview for NSX-T Fling

Next, extract the module and place it into one of your $PSModule directories. Better yet, do it with PowerShell:

We can then verify the module was placed in the proper location and is available for us to use:

Unzipping the Fling download

Note: If you don’t see the VMware.VimAutomation.Nsxt module, you probably need to install the latest version of PowerCLI. Walkthroughs on how to do that are available:

Now that we can see the module, I would suggest browsing through all of the 280 cmdlets available in the module. We can do that with the following command:

Browsing through all the available cmdlets in the Fling Module

One last step before starting to use the new cmdlets, we need to authenticate to the NSX-T server. This requires the VMware.VimAutomation.Nsxt module because it makes available the ‘Connect-NsxtServer’ cmdlet. We can authenticate to the NSX-T server with the following command:

Authenticating to the NSX-T Management Server

We are now authenticated and ready to start pulling information from the environment. Following along with the prior blog post, let’s start by pulling information about our cluster. We can do that with the ‘Get-ClusterNodeConfig’ cmdlet.

Example: Get-ClusterNodeConfig

We can clean up the output through the use of the ‘Select-Object’ cmdlet with the following command:

Example: Simplifying output for Get-ClusterNodeConfig

Another item we looked at in the last blog post, Transport Zones. The ‘Get-TransportZone’ cmdlet can be used, however if we want to clean it up a bit we can run the following command:

Example: simplified output for Get-TransportZone

One last example, we’ll get the status of the cluster. This can easily be done with the ‘Get-ClusterStatus’ cmdlet. However, the results are probably not what you expect. The ControlClusterStatus and MgmtClusterStatus each have an additional nested property of ‘Status’ which we’ll need to gain access to for this to really make sense. To do that, we’ll create a custom dynamic property with PowerShell! These custom properties will be made of hashtables used as part of the ‘Select-Object’ cmdlet. Each hashtable will need a ‘Name’ and an ‘Expression’. Here’s an example of this concept with the ‘Get-ClusterStatus’ cmdlet:

Example: Get-ClusterStatus and handling nested property values

Summary

There’s a great new fling available called the PowerCLI Preview for NSX-T Fling. This fling adds an additional 280 high-level cmdlets for VMware NSX-T, like Get-TransportZone, which means that automating NSX-T has never been easier!

As with all of our Flings, please leave feedback on the Comments section! We want to know what you think. What cmdlets are you using the most? What should the output look like? What cmdlets aren’t working the way you think they should? What cmdlets are missing? As well as any other feedback you can come up with!

PowerCLI Core Fling – Available For Download!

I am extremely excited to announce that the PowerCLI Core Fling has been released and is available for download!

Before getting to the download link, let’s cover a couple things first.

This release is based on, and requires, Microsoft PowerShell Core and .NET core. If you do not already have it installed, see the accompanied documentation for a walkthrough on getting started.

Feedback is very much welcomed. Please use the Fling site’s comment section to submit feedback. Keep in mind, we improve the product based off of your feedback, so please do let us know!

Enough suspense, the PowerCLI Core Fling is available here: https://labs.vmware.com/flings/powercli-core

Check out this demo of the install process on a Linux system:

Enjoy, and don’t forget the feedback!

PowerCLI Core Coming to a Fling Near You!

One of my favorite announcements at VMworld happened to be about PowerCLI, of course! The big announcement was about its future availability on multiple platforms, including Linux and Mac OS X. This functionality has been one of the biggest requests the PowerCLI team has received over the years and it is extremely exciting that it’s finally coming!

The announcement actually happened during Alan Renouf and Luc Dekens’ session INF8092 titled: The Power Hour: Deep Dive, DevOps, and New Features of PowerCLI. The response in the room was amazing. Then, when Alan asked who would be planning on running PowerShell and PowerCLI on Linux and/or Mac OS, the amount of hands that went up was staggering. In fact, it was so staggering that Alan had to take a picture:
INF8092

I would be remiss if I didn’t mention how this was all made possible by our friends at Microsoft. This past August, Microsoft actually open sourced PowerShell which in turn opened the ability for PowerCLI to be run on multiple platforms.

VMware, and PowerCLI in particular, were involved as special guests when Microsoft made the open source announcement. If you haven’t checked out the announcement video, it’s worth a watch. Pay particular attention around the 46-minute mark:

At this point, you’re probably looking for more details. PowerCLI Core, the multi-platform version of PowerCLI, will be released as a VMware Fling. However, it has not been made available as of yet. The PowerCLI Engineering team is, and has been, working extremely hard on preparing the release.

I’ve had a chance to play with an early version, and it’s amazing. They’ve done an excellent job and it really is just that cool. It still puts a smile on my face every time I do this:
PowerShell on OSX

In the meantime, here is a video showcasing the upcoming Fling:

If you want to watch Alan and Luc’s session INF8092 where the announcement was made and check out all the other awesome PowerCLI goodness that was made available at VMworld, the session is viewable today. It’s also worth mentioning that the session was voted into the Top Ten Sessions of the Day, so I would consider it a ‘must see’! Direct Access to the video available here.

Using VMware Instant Clone via PowerCLI Extensions Fling

FLINGS.png

In the last post I anounced the new PowerCLI Extensions fling, which allows admins to leverage the Instant Clone abilities found in vSphere 6. Today I’m going to walk you through how to use it.

Prerequisites

To be able to fully leverage PowerCLI Extensions, you will need to meet the following requirements Continue reading

VMware Instant Clone is now at your fingertips with the updated PowerCLI Extensions fling!

 

FLINGS.png

At VMware we are pleased to announce the publishing of a new fling:  PowerCLI Extensions! PowerCLI Extensions gives PowerCLI users access to early access functionality by extending the core PowerCLI cmdlets to include new experimental features and gives PowerCLI customers the ability to provide early feedback. So what is included in this fling? Read on…

Continue reading

New Fling: Onyx for the Web Client

FLINGS

I am pleased to announce that we have just released Onyx for the Web Client!  Continue reading