Home > Blogs > VMware PowerCLI Blog

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.

VMworld Sneak Peek: INF8038 – Getting Started with PowerShell and PowerCLI

VMworld US 2016

VMworld Session INF8038 is going to be great regardless of whether you’re new to PowerShell or just in need of a refresher. The session will be packed full of information from getting your PowerShell profile setup to understanding the difference between a module and a snap-in, then starting down the path of using logic statements and even creating your own scripts.

Check out this video by Chris Wahl to get a sneak peek on what to expect:

Don’t forget to register for the session by way of the VMworld Content Catalog!

PowerCLI at VMworld US 2016

VMworld US 2016

It’s August, and that means the countdown to VMworld US has officially begun! Hopefully you’ve already registered. If not, what are you waiting for? We’ve got a ton of great PowerCLI and automation based activities lined up for this year, and some more still in the planning phases. Check back here often to keep up to date.

Sessions

Monday, August 29, 11:00AM to 12:00PM – Kyle Ruddy & Chris Wahl
INF8038 – Getting Started with PowerShell and PowerCLI for Your VMware Environment: VMware’s PowerCLI is one of the most complete, mature, and widely adopted extensions to the framework. It includes a plethora of functions that abstract the vSphere API down to simple and powerful cmdlets for operating your vSphere environment. In this session you’ll learn how modules, snapins, functions, and scripts relate to one another, how to install and configure your PowerShell Integrated Scripting Environment, setup a profile, and begin writing PowerCLI scripts using safe, non-destructive starter code. We’ll also dive into exploring objects, extension data, and perform simple logic statements.

Wednesday, August 31, 1:00PM to 2:00PM – Nicholas Bradford & Anthony Burke
NET7514 – PowerNSX and PyNSXv: Using PowerShell and Python for Automation and Mangement of VMware NSX for vSphere: Regardless of whether you are a Windows guru, or dream in awk and sed, there are powerful command-line and scripting tools as well as programing language bindings available to you for managing VMware NSX for vSphere environments. This session will take a light hearted, but informative, look at two tools that enable you to query, manage, manipulate and automate your VMware NSX for vSphere platforms.

Tuesday, August 30, 5:00PM to 6:00PM – Jason Boche & Mike Matthews
STO8923 – PowerShelling Storage to the Extreme: With enterprise vendors providing rich PowerShell snap-ins to their products, just how far can you take these cmdlets? Combining VMware’s cmdlets with cmdlets for servers, storage, networking, and applications, can take the monotony out of day to day tasks, and ensure completion. But why stop there? They’ll take a look at more complex storage-based solutions that can be scripted into simplicity. Let your imagination be the limit!

Monday, August 29, 2:00PM to 3:00PM – Duncan Epping & Chris Wahl
INF8036 – Enforcing a vSphere Cluster Design with PowerCLI Automation: The amount of VMware vSphere data center, cluster, storage, and network options available to an administrator is massive. Even specific features such as High Availability and the Distributed Resource Scheduler have a ton of different configuration settings provided to meet the needs of your specific virtualized workloads. It can be a challenge, however, to audit the settings and best understand why they were set in the first place—especially as other administrators join and leave your organization! In this session, see how they take a look at abstracting vSphere configuration settings into declarative configuration files. Also, learn how to audit, track, and enforce consistent settings to ensure the availability and standardization of your vSphere environment.

Tuesday, August 30, 12:30PM to 1:30PM – Luc Dekens & Alan Renouf
INF8092 – The Power Hour: Deep Dive, DevOps, and New Features of PowerCLI: Alan and Luc will present you with a state of the union for PowerCLI, discussing what’s new, what’s changed, and what it means for you. Be sure to attend for exciting news and tech preview features and demonstrations. With the rise of all things DevOps, this session will also show you the latest state of the community-driven VMware vSphere DSC resources, including why and how to use them, what they are, and what’s in store. This session will be filled with best practices, including fast(er) statistical reports and assigning SCSI IDs and payment card industry slot numbers. Don’t reinvent the wheel, just copy our code!

Sunday, August 28, 9:30AM to 10:30AM – Vinith Menon
STO8267 – Hours to Minutes: Automated Provisioning and Deployment Using PowerCLI, vRealize Automation and vRealize Orchestrator: VMware IT has a large project portfolio with over 60 remote sites that need to be provisioned with core footprint virtual machines (VMs). The deployment of these machines requires additional resources and expenses. VM lifecycle management and application configuration (creation to retirement) is time-consuming, error prone and involves manual efforts. The ability to automatically provision new infrastructure and reduce manual efforts is a vital building block to establishing an on-demand model for IT and to better serving the needs of the business by reducing costs and increasing efficiency. The VMware IT Tenant Operations team will discuss its solution using PowerCLI, vRealize Automation (vRA) and vRealize Orchestrator (vRO) that reduces critical provisioning time to configure the footprint VMs from hours to minutes on the EVO VxRail platform.

Group Discussions

Tuesday, August 30, 5:00PM to 6:00PM
INF10730-GD – PowerCLI with Kyle Ruddy and Alan Renouf: Group Discussions are a good way to join together with peers, guided by a VMware expert, and discuss a VMware key topic as selected by the group. Come to this session prepared to dive-in, engage, and share best practices.

Expert Lead Workshop

Thursday, September 1, 1:30PM to 3:00PM – Jon Harris & Vinith Menon
ELW-1721-SDC-6 – Introduction to VMware PowerCLI: In this Expert-led Workshop, go hands-on with VMware PowerCLI. Gain familiarity with the tool, and then dive deeper into the functionalities available in this exciting product. Both new and experienced users are sure to learn something new.

Hands-On Labs

SPL-1721-SDC-6 – Introduction to VMware PowerCLI: Go hands-on with VMware PowerCLI. Gain familiarity with the tool, and then dive deeper into the functionalities available in this exciting product. Both new and experienced users are sure to learn something new.

SPL-1783-HBD-1 – VMware vCloud Air – Manage Your Cloud: VMware vCloud Air can be managed through multiple solutions depending on your needs and requirements. In this lab we will look at how we can connect to our vCloud Air environment through the vRealize Cloud Management Platform, utilizing the power of vRealize Automation to provision and manage workloads running in vCloud Air. We will also look at how we can use PowerCLI to automate tasks in vCloud Air. Finally we will show how vRealize Operations can be used to operate and manage our vCloud Air environment.

Using PowerCLI to Configure Hosts

We’re continuing the video series on learning PowerCLI tips and tricks. Previously, we’ve focused on an introduction, creating reports, and handling the VM lifecycle. We will now be focusing on the host configuration process.

This is one of those processes that admins may not do on an everyday basis, but is a huge time saver once automated. However, the individual commands can be run at any time and not just during the configuration process. Using the New-VirtualSwitch cmdlet as an example, it can be reused on multiple hosts to not just provide a time savings during creation but also provide consistency as the commands are ran on each host. Then, once through the individual steps, the video also takes it a step further and finishes up with a way to tie everything in to a script for an automated workflow.

This video shows how to perform the following tasks easily:

  • Adding a Host to vCenter
  • Putting a Host in Maintenance Mode
  • Assigning a license key to a Host
  • Configuring a Host’s NTP server
  • Creating a Virtual Switch on a Host
  • Creating a Port Group on a Host
  • Enabling vMotion on a Host’s Port Group
  • Creating both VMFS and NFS based datastores on a Host
  • Activating a Host
  • Tying all these actions together into a single script

The entire process takes less than 5 minutes, and the script completes in less than 1 minute!

Watch the Video

Other videos available in the series are available below. If you haven’t seen them yet, I highly recommend them. They are all quick, easy to learn and easy to reproduce in your own environment.

Updating the VMware PowerCLI Community Repository!

PowerCLI + GitHub
If you’ve ever tried searching for a script or a module before, you know it’s not the easiest thing to accomplish. This sentiment has been coming up more and more as of late. There’s a ton of amazing PowerCLI scripts and modules, PowerActions scripts, DSC resources, and so forth contributed by the community and openly available.

The VMware PowerCLI Community Repository is a central location where anyone can contribute their own resources. The repository features a Principles of Operations document to help guide contributors along the process of using, creating, and updating resources which are contained within the repository.

This community repository will also feature several community members as board members. As part of the board, they will be asked to help maintain the repository with tasks such as testing and providing feedback on all submitted resources, communicating with other board members in order to approve pull requests, and continuing to be good community advocates of PowerCLI and the community repository.

I’d like to thank and welcome the following board members:
Josh Atwell (Community Member)
Luc Dekens (Community Member)
Jonathan Medd (Community Member)
Alan Renouf (VMware)
Kyle Ruddy (VMware)
Rynardt Spies (Community Member)

Now that we have the announcements out of the way, let’s take a look at how to dig in and get started.

Getting Started

Accessing the Repository

Downloading the Repository for Local Access
If you happen to be new to GitHub and want to access the contents of the repository, one of the easiest ways to that is to just download a copy of it directly from GitHub to your local system:

  1. Load the following GitHub repository page: VMware PowerCLI Community Repository
  2. Click on the green “Clone or Download” button and then click “Download ZIP”
  3. Once downloaded, extract the zip file to the location of your choosing
  4. At this point, you now have a local copy of the repository

Download PowerCLI Repository

Creating Your Own GitHub Based Access Point
Another one of the easiest ways to access the repository contents is to “fork” it, which places a copy of the repository within your account:

  1. Login (or signup) to GitHub
  2. Load the following GitHub repository page: VMware PowerCLI Community Repository
  3. Click on the Fork button, which will create a copy of the repository and place it in the GitHub based location of your choosing.

Adding Resources

GitHub – Copy/Paste Option
If you happen to want to contribute a script or other resource and are new to GitHub, you have the ability to copy and paste your resource directly to the repository:

  1. Within the community repository, browse to the appropriate section (example: Scripts)
  2. Select the “Create new file” button
  3. On the new page, enter a file name, enter the resource’s information
  4. Within the “Commit new file” area, enter the title and description, then select “Create a new branch for this commit…” and enter a sensical branch name
  5. Click “Propose new file”
  6. On the “Open a pull request” page, click “Create pull request”

Submit to PowerCLI Repository

GitHub – Upload Files Option
Similarly to the copy and paste option above, you can also upload your resource directly to the repository as well:

  1. Within the community repository, browse to the appropriate section (example: Modules)
  2. Select the “Upload files” button
  3. On the new page, drag or choose the files to add
  4. Within the “Commit changes” area, enter the title and description, then select “Create a new branch for this commit…” and enter a sensical branch name
  5. Click “Propose new file”
  6. On the “Open a pull request” page, click “Create pull request”

GitHub Desktop Client

There are numerous other ways to interact with the community repository other than just the GitHub web interface. The GitHub Desktop is a great way to setup and streamline your interaction with any GitHub Repository. More information is available at GitHub’s Desktop Client Getting Started page.

GitHub Desktop Client

Conclusion

The goal of the VMware PowerCLI Community Repository is to bring the great PowerCLI resources from the community into a central location that’s easy to find, search, use, and contribute to regardless of the user’s technical skill level.

If there’s any questions, comments, or feedback, join us in the VMware Code Slack team’s PowerCLI channel: https://code.vmware.com/slack/

New PowerCLI Based Training Course!

VMware Education ServicesIt’s been a while since a new PowerCLI related course has been released by VMware Education, but they heard the requests and have released a new 5-day course! The course is titled “Data Center Automation with vRealize Orchestrator and vSphere PowerCLI” and will take experienced vSphere administrators down the path of automating their day to day tasks.

Attendees will gain a wealth of knowledge about PowerCLI and vRealize Orchestrator (vRO) based automation tips and tactics, regardless of their experience level. The course will set the ground work by covering some high level automation principles and then dives right in on the vSphere API. Upon learning the importance of the vSphere API as well as how it’s utilized, it’s PowerCLI time! Attendees will learn the basics, such as using the cmdlets, setting variables, and invoking PowerCLI object methods, then get into some more advanced concepts like accessing the underlying API and using the Onyx fling.

The rest of the course will cover vRO by making sure the attendees understand the basics, how to use and create workflows, how to tie in Windows PowerShell, and finally combining vRO and PowerCLI together to perform some guest operation activities.

The course is jam packed with lots of automation and PowerCLI goodness, and is certainly a must attend.

To find out more information and sign-up, head over to the VMware Education site’s for the Data Center Automation with vRealize Orchestrator and vSphere PowerCLI course.

Which Version of PowerCLI is Right For Me?

“I have PowerCLI 5.5 installed because I manage a vSphere 5.5 environment. I’ll update to PowerCLI 6.0 when I upgrade my vSphere environment to 6.0.”

Sound familiar? This is one of the most common things we hear during VMUGs, customer meetings, and around the community in general. This also happens to be a HUGE misconception. The current version is PowerCLI 6.3 Release 1 and it is compatible with all the supported vSphere versions!

Don’t take my word for it, check out the compatibility matrix:
PowerCLI Compatibility

As displayed in the compatibility matrix above, significant effort has been made to ensure backward compatibility while still being able to offer all of the latest and greatest updates and feature enhancements.

At this point you’re probably wondering what version of PowerCLI you’re using? Open up your PowerCLI window and have a look at the “Get-PowerCLIVersion” cmdlet:
Get-PowerCLIVersion

Conclusion

PowerCLI is extremely backward compatible and we highly recommend upgrading to the latest version: PowerCLI 6.3 Release 1.

Take advantage of the following benefits:

  • Get-VM cmdlet optimizations
    Saying Get-VM is faster is just an understatement, some of the numbers we’ve received from the community are amazing!
  • Get-View cmdlet improvements
    Get-View now allows for tab completion of the -ViewType parameter
  • Added Content Library functionality
    The new Get-ContentLibraryItem cmdlet retrieves Content Library items as well as the ability to specify a Content Library item while using the New-VM cmdlet.
  • Get-ESXCLI improvements
    Major upgrade to the Get-ESXCLI cmdlet to now allow the passing of arguments by name instead of position simply by adding the -V2 parameter
  • Added PowerShell v5 and Windows 10 support
  • Added support for the following VMware products: vCloud Director 8.0 and vRealize Operations Manager 6.2

A couple notable resolved issues:

  • Get-VM
    If you try to run Get-VM without specifying any parameters, you might receive an error message of type Value cannot be null.
  • Export-EsxImageProfile
    If you try to export an image profile, you receive an error message of type Cannot instantiate ‘certified’ policy: VibSign module missing.
  • New-DeployRule
    If you try to create a new deploy rule by passing absolute values of host profle, cluster, datacenter, or folder instead of passing the objects, you receive an error message of type Cannot process argument transformation on parameter ‘Item’. Unsupported version URI urn:rbd1/3.0.

For more information on changes made in vSphere PowerCLI 6.3 Release 1, including improvements, security enhancements, and deprecated features, see the vSphere PowerCLI Change Log. For more information on specific product features, see the VMware vSphere PowerCLI 6.3 Release 1 User’s Guide. For more information on specific cmdlets, see the VMware vSphere PowerCLI 6.3 Release 1 Cmdlet Reference.

Upgrade by heading over to the vSphere PowerCLI page and downloading it today!

Welcome a new face to the team

 

3TSeV8RqYou are about to see new and exciting blog posts arrive from a fresh face on the team.  Please do join me in welcoming the new Technical Marketing expert on all things PowerCLI – Kyle Ruddy.

Kyle works as part of our Technical Marketing team, being responsible for vSphere Operations Management and will also cover APIs / SDKs and CLIs.

Kyle has been a big fan of PowerCLI, and automation in general, having technically reviewed PowerCLI books, presented PowerCLI based VMUG sessions, and been a strong community contributor. Kyle’s focus will be to continue evangelizing PowerCLI and its use to help VMware customers increase their productivity and consistency and to bring you the latest and greatest in news and new ways to use PowerCLI.

During his spare time, Kyle enjoys golfing, SCUBA diving, and most motorsports activities.

 

You can find Kyle’s personal blog at http://thatcouldbeaproblem.com and can contact him on twitter via @kmruddy

Blogger Talk Show–Pilot Episode on PowerCLI

Here at VMware we are always trying to make sure we give you the information you need in a way that you can best consume it.

With this in mind, a little while ago I was asked to take part in a pilot for a new talk show VMware is looking to gain feedback on, this gives us the chance to give you more information in a less formal way and you to learn more about a given subject.

The initial talk show is a little rough around the edges but please do take 30 minutes out of your busy schedule to check it out and perhaps learn a little more about PowerCLI and how to work with VMs in particular.

Watch the video

Continue reading

Using the entire API for vRealize Operations via PowerCLI

Previously we showed you how to use the useful cmdlets available with the PowerCLI vRealize Operations Manager (vR Ops) module, but as we also explained there are only a few cmdlets at the moment and anyone who knows vR Ops will know that there is a lot more functionality than is provided by those cmdlets.

But don’t worry, it is possible to access the entire vR Ops REST API!  PowerCLI gives us the ability to expand the capability of the module to perform many more tasks that aren’t available via the included cmdlets.

In this blog post, which is a continuation of my previous blog posts on the PowerCLI vR Ops module, I will explain how to access the entire vR Ops public REST API via PowerCLI.  Before I begin, it will be helpful to cover some basic information about the vR Ops REST API.

The API is available via the base URI of https://{vrops-IP}/suite-api and if you browse to this link the documentation is available.  For the most part, the API is pretty well documented with examples for usage including payloads for XML and JSON.  Below is a screenshot of the XML request body example for the performAction method.

clip_image002 Continue reading