We are extremely excited to announce that the first standalone tech preview release of the new Power Actions went live today.
Power Actions is a vSphere Client plug-in that provides an easy way to share PowerCLI scripts with users who have no PowerShell experience. Power Actions provides a script library where you can upload PowerCLI scripts that you want to make available to everyone in your organization. Users can then easily execute those scripts using a user-friendly interface to specify the script parameters. This provides an extremely powerful mechanism to extend the vSphere Client with custom PowerCLI scripts.
How about the security and permissions? All the scripts are executed by using the permissions of the user that’s logged in to the vSphere Client. So, if a user does not have permission to perform certain operations they won’t be able to perform these operations with Power Actions as well.
Let’s take a closer look at how to get started with Power Actions:
Installation
Power Actions is distributed as a virtual appliance. You can download the OVA file from the Power Actions page. Also from there, you can download the complete user’s guide that contains detailed installation instructions. After you install Power Actions you can use it through the Developer Center in the vSphere Client.
Script library
The main function of Power Actions is to run scripts from your script library. So the first thing to do is to create a script library and upload your scripts there.
Script libraries are actually content libraries, so any content library can be used as a script library. If you don’t have a content library at your disposal, you can create a new one by using either PowerCLI or the vSphere Client. The next step is to import your scripts to the script library. You can upload scripts one by one through the vSphere Client, or entire collections of scripts through PowerCLI.
Running scripts
Once you have uploaded your scripts to the script library, you can start running them. You have two options to run a script – from the script library directly or through the context menu. In both cases, when you execute a script with parameters, you’ll be prompted to enter them. However, when you run a script from the context menu, some parameters will be pre-populated.
Let’s take a closer look at how this works. In our Power Actions script library we have imported a simple PowerCLI script that creates snapshots of a collection of virtual machines. This is what the script looks like:
1 2 3 4 5 6 7 8 9 |
param ( [Parameter(Mandatory=$true)] [VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine[]] $vms, [Parameter(Mandatory=$true)] [string] $snapshotName) foreach ($vm in $vms) { New-SnapShot -VM $vm -Name $snapshotName } |
When we run this script from the script library, we’ll get a dialog in which we’ll have to specify the script parameters.
However, if we want to run the script from the context menu, we can right-click on a VM and select “Power Actions” -> “Run script”.
We’ll get a dialog to first select the script that we want to run, and then we’ll have to enter the parameters. In this case, the vms parameter will be pre-populated from the VM we right-clicked on.
Monitoring script runs and checking the results
The next screen in Power Actions is ‘Script runs’. There you can monitor your script runs and check their result. From this page you can also stop a running script.
Console
Another feature Power Actions provides is a built-in PowerShell console with the latest PowerCLI version pre-installed. When you open the console, it automatically connects to the vCenter Server by using the vSphere Client user. You can use the Power Actions console to run single commands or entire scripts. Keep in mind that the console will not be retained when you log out of the vSphere Client, so any files that you save on it will be lost after you log out. Beware that if you switch to another view in the vSphere Client or to another Power Actions screeen, and then return to the console, a new PowerShell session will be created and all in-memory variables from your previous session will be lost.
Summary
Throughout the years, Power Actions underwent multiple transformations and was part of different fling releases of the vSphere Client. Now we’re starting to develop it again as an independent product and this first tech preview release of the new Power Actions is the first step of the process. We are very excited about the plethora of possibilities that Power Actions brings and we can’t wait to receive your feedback, use cases, feature requests and ideas. So don’t hesitate to submit your comments on the Power Actions site.