New book – Learning PowerCLI – Second Edition

Learning PowerCLI - Second Edition CoverToday, my new book Learning PowerCLI – Second Edition was published by Packt. Learning PowerCLI, Second Edition will learn you to leverage the power of PowerCLI to automate your VMware vSphere environment with ease.

Starting with an introduction to the basics of PowerCLI, the book will teach you how to manage your vSphere and vCloud infrastructure from the command line. To help you manage a vSphere host overall, you will learn how to manage vSphere ESXi hosts, and deploy and upgrade ESXi hosts using Image Builder and Auto Deploy.

The upcoming chapters will not only teach you how to create datastores and datastore clusters, but you’ll also work with profile-driven and policy-based storage to manage your storage. To create a disaster recovery solution and retrieve information from vRealize Operations, you will learn how to use Site Recovery Manager and vRealize Operations respectively.

Towards the end, you’ll see how to use the REST APIs from PowerShell to manage NSX and vRealize Automation and create patch baselines, scan hosts against the baselines for missing patches, and remediate hosts. By the end of the book, you will be capable of using the best tool to automate the management and configuration of VMware vSphere.

Compared to the first edition, Learning PowerCLI – Second Edition is updated to vSphere 6.5 and PowerCLI 6.5. Learning PowerCLI – Second Edition contains five new chapters about vSphere Update Manager, vCloud Director and vCloud Air, Site Recovery Manager, vRealize Operations Manager, and using REST API to Manage NSX and vRealize Automation. Read more of this post

Running PowerShell in a Docker container on VMware Photon OS

PowerShell logoA few days ago Microsoft provided PowerShell as an open source project on GitHub, available on Windows, Linux and macOS! The first open source release is PowerShell 6.0 Alpha. In this blog post, I will show you how to run the new PowerShell version in a Docker container on VMware Photon OS. Read more of this post

New VMware fling: Onyx for the Web Client

PowerCLI logoVMware Onyx has been a very popular fling for many years. You can use Onyx to create PowerCLI code by performing actions in the VMware vSphere client. The created PowerCLI code does exactly what you did in the client. The PowerCLI code can easily be adapted to your own needs.

Unfortunately Onyx was not available for the vSphere Web Client. This was a pitty because since vSphere 5.1, new features were not built into the vSphere client. So you could not use Onyx to create PowerCLI for the new vSphere features. I am very happy that VMware now has released a new fling: Onyx for the Web Client. Read more of this post

Upgrading your VMFS datastores with PowerCLI

PowerCLI logoWith the release of VMware vSphere 5.0 a new version of the VMFS datastores was released also: VMFS-5. This new VMFS-5 version has a lot of advantages over the old VMFS-3 version (see for information about the new features Cormac Hogan’s post vSphere 5.0 Storage Features Part 1 – VMFS-5). You can upgrade your VMFS-3 datastores to VMFS-5 while VM’s on the datastores keep running. In this post I will show you the vSphere PowerCLI Upgrade-VmfsDatastore function that will do the upgrade for you. Read more of this post

PowerCLI Get-VICommand function error repaired

PowerCLI logoOn my PC (Windows 8 Pro, Windows PowerShell 3 and VMware vSphere PowerCLI 5.1 Release 2) there is a very annoying problem with the Get-VICommand function. If I use this function without specifying the name of a cmdlet to search for, then I get an “Object reference not set to an instance of an object” error message:

PowerCLI C:\users\robert> Get-VICommand
get-command : Object reference not set to an instance of an object.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1:68 char:3
+   get-command -pssnapin VMware.* -Name $Name
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Command], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetCommandCommand

Listing 1. Get-VICommand error message with PowerShell 3.
Read more of this post

Get VMware vCenter Scheduled Tasks with PowerCLI

PowerCLI logoVMware vSphere PowerCLI is missing cmdlets to work with VMware vCenter Scheduled Tasks. In a series of blog posts I will show you some PowerShell advanced functions that you can use to work with vCenter Scheduled Tasks. The first function is Get-VCScheduledTask. You can use this function to retrieve one or more scheduled tasks from your vCenter Server. Read more of this post

Use PowerCLI to consolidate snapshots in vSphere 5

PowerCLI logoIn vSphere 5 a virtual machine can have a “Virtual machine disks consolidation is needed” Configuration Issue warning in the Summary tab. How can you use PowerCLI to see which virtual machines have this warning? And how can you automate the consolidation of the virtual machine’s disks? Read more of this post