DSCR and Pester testing

In my previous post DSCR for VMware and you! I described the open source project that was started to develop DSC resources for vSphere (DSCR). One of the requirements for contributing, is that you provide Unit and Integration Pester tests for any new DSC resource you contribute to DSCR.

The vSphere environment and VMware PowerCLI have some peculiarities that will require you to use some specific Pester techniques to write these Pester tests. This post should help you understand how this done. This is not intended as a Pester course, there are other, and better, resources for that.

Continue reading DSCR and Pester testing

DSCR for VMware and you!

On December 13th 2018 the PowerCLI Team provided us with an early end-of-year present. The Desired State Configuration Resources (DSCR) for VMware are published, and they are open sourced!
If you missed the announcement, hold what you are doing, and go read the VMware PowerCLI blog post Getting Started with Desired State Configuration Resources for VMware right now!

The next question on your mind is probably “How can I contribute?“. Well, with the correct tools and some VMware PowerCLI knowledge, it turns out that this is not too difficult. What follows is my first attempt at contributing to the Desired State Configuration Resources for VMware.

Continue reading DSCR for VMware and you!

ChatOps Bot

I do love integration, and especially when it is done in a new, innovative way.

My friend Dennis Zimmer, from Opvizor, recently gave me access to a preview of one of their new tools, which they called ChatOps Bot for VMware vSphere. It combines  vSphere API calls with Slack API calls. Needless to say I liked the concept. And I can see many interesting possibilities.

Have a look.

Continue reading ChatOps Bot

vSphereDSC – VmwFolder

In this post I’ll introduce the first DSC resource from the vSphereDSC module, the VmwFolder resource. Since this is the first post in the series, I will also expand a bit on how the vSphereDSC module is set up and which conventions I’m using.

VmwFolder

A vSphere Folder is a resource which can exist rather independently in an existing vSphere environment. You can easily create some test Folders to get the hang and feel of the vSphereDSC module and play with DSC Configurations based on this vSphereDSC resource.

Continue reading vSphereDSC – VmwFolder

vSphere Object by Path

In an older post, named Folder by Path, I provided a function to retrieve a Folder object by it’s path.

With the recent publication of my Get-InventoryPlus function, I can now get the path to all vSphere objects. So the obvious next step was to create a function, that would be able to use that information and retrieve any vSphere object by it’s path.

IMG_20160602_084338

The function was first demonstrated during the 24th VMUGBe in Mechelen.

Continue reading vSphere Object by Path

Get-InventoryPlus – Inventory of all vSphere objects

Often I have to get a complete list of all the objects in a vSphere environment. From the PowerCLI cmdlets, the Get-Inventory cmdlets looks like the obvious candidate to tackle such a request. But the cmdlet seems to have some shortcomings. It definitely does not return all vSphere objects.

Hence I set out to write this Get-InventoryPlus function.

The function was demonstrated for the first time during the 24th VMUGBe in Mechelen.

Continue reading Get-InventoryPlus – Inventory of all vSphere objects

Le Onyx nouveau est arrivé ! *

Did you convert to the vSphere Web client when you installed vSphere 5.5 or 6.0 ?

Are you using PowerCLI ?

Do you sometimes use SDK API methods for those special scripts ?

If you answered yes to some of these questions, you must be missing the Onyx Project application ! Well, your patience is rewarded. In the Fling repository you will find, starting today, the new Onyx for the Web Client v1.0 package.

OnyxMain

With the new Onyx you can watch which methods and properties all your Web Client actions are using. And with that knowledge you can easily ascend another level or two on your path to automation nirvana !

Continue reading Le Onyx nouveau est arrivé ! *

DRSRule – a DRS rules and groups module

One of the nice vSphere features is the ability to define DRS rules.

DRSRule-introThe feature allows a vSphere administrator to control the placement of virtual machines in a vSphere cluster. There are the VM to VM affinity and anti-affinity rules, and the newer VM to VMHost rules. With the VM to VMHost rules, vSphere introduced the concept of VM and VMHost groups, and the ability to have rules that are a requirement (‘shall’) or a preference (‘should’).

In a recent VMTN PowerCLI community thread a PowerCLI user had a query about exporting and importing DRS rules and groups. At that point Matt Boren and myself developed the idea to provide a PowerShell module. The PowerShell module, which we named DRSRule, provides all the functions we deemed useful for working with DRS rules and groups. And yes, the module includes an export and an import cmdlet !

Continue reading DRSRule – a DRS rules and groups module

Task Data Mining – An improved Get-Task

Quite frequently there are questions in the VMTN PowerCLI Community for scripts that report on the tasks that ran in a vSphere environment.

The PowerCLI pssnapin provides a Get-Task cmdlet, but that only provides information about the recent tasks. An alternative is to use the Get-VIEvent cmdlet and extract all the TaskEvent entries.

But why not use the TaskHistoryCollector and it’s methods ? It provides many filtering options, and since this filtering is done in vSphere itself, this way of working is inherently much faster than using a filter in your script.

In analogy with the Get-VIEventPlus function, I published in my Get the vMotion/svMotion history post, here is the Get-TaskPlus function !

Update February 13th 2020

  • Added logic to break out of do-while loop and destroy the TaskCollector to avoid issues with max 32 collectors

Continue reading Task Data Mining – An improved Get-Task

dvSwitch scripting – Part 13 – Export/Restore Config

One of the exciting new dvSwitch features in vSphere 5.1 is the ability to export and restore a dvSwitch configuration. This new feature is only available through the vSphere Web Client.

On Hypervisor.fr, a blog you should have in your RSS reader, there were already posts on how to configure the dvSwitch healthcheck and how to do a dvSwitch configuration rollback from PowerCLI. But till now, as far as I know, there were no functions to provide the dvSwitch export/restore functionality.

dvSw-export-import

Time to make this useful functionality available for the “PowerCLI automation crowd” 😉

Continue reading dvSwitch scripting – Part 13 – Export/Restore Config