Initiating and managing the Podfederation in a Horizon Cloud Pod Architecture using PowerCLI & API’s

One of the new cmdlets for the vmware.hv.helper that I am currently working on is initiating the Cloud Pod Architecture (CPA) and more actions related to this. This blog post will show the basics about initiating, and joining a CPA using the API’s. Doing things with site’s within the CPA will be covered in a later blogpost.

If we look at the services available in the Horizon API’s you’ll see that podfederation is one of them, let’s take a look at that and what method’s are available.

$services1.PodFederation | gm

So we can Eject, Get, Initialize, Join, Unintialize, Unjoin and update a podfederation. If we look at the brackets behind the methods than (un)initializing and unjoin don’t need any extra info so let’s get ahead and initialize the podfederation. To show you there’s nothing there yet I made a screenshot of the admin interface.

[sta_anchor id=”initialize” /]

Initialize the podfederation

Now to initiate the podfederation

$services1.PodFederation.PodFederation_Initialize()

And if you are quick enough in switching to the admin interface will also still show it initializing

[sta_anchor id=”get” /]

Get information about the federation

With podfederation_get() we can grab the configuration information.

$services1.PodFederation.PodFederation_Get()
($services1.PodFederation.PodFederation_Get()).data
($services1.PodFederation.PodFederation_Get()).localpodstatus
($services1.PodFederation.PodFederation_Get()).localpodstatus.LocalConnectionServerStatuses

Not a lot of information but there isn’t a lot more anyway in the podfederation itself.

[sta_anchor id=”join” /]

Join a federation

I have another pod that I want to join to this federation since we’ve already seen that this needs some more input let’s check what it exactly needs.

$Services1.PodFederation.PodFederation_join

So we need a remotepod address, presumable one of the connection servers in that pod will be enough, a username where domain\username will do just like in the admin console and a password of the type vmware.hv.securestring. The last one was new for me but thankfully it was described in one of the examples in the api explorer (https://code.vmware.com/apis/75/view and click on Data Object Types).

$vcPassword = New-Object VMware.Hv.SecureString
$enc = [system.Text.Encoding]::UTF8
$vcPassword.Utf8String = $enc.GetBytes('passwd')

With this it’s easy to add the local pod to the podfederation

$Services1.PodFederation.PodFederation_join("connectionserver","domain\username",$svcpassword)

And again if you are fast enough this is also visible in the admin console

And now a get will also show that it has been enabled

[sta_anchor id=”unjoin” /]

Unjoining a Podfederation

If you are braking down a pod because of whatever reason the best way to do this is to unjoin the pod from the federation. As we saw before there’s no extra information need so you just need to connect to a connection server in that pod and do an unjoin.

$services1.PodFederation.PodFederation_Unjoin()

this is really fast so over several tries I did not succeed in making a screenshot of the admin console.

[sta_anchor id=”eject” unsan=”Eject” /]

Ejecting a pod

This is the only podfederation function not available through the admin console as far as I could see. Ejecting a pod for is for me a last option if a datacenter burned down, everything is gone and you want to get rid of the pod. I did it in my lab against an alive pod and had to uninitialize the (now unlinked) podfederation from that pod to be able to rejoin it to the correct pod. This method also requires some input so let’s see what that is.

$services1.PodFederation.PodFederation_Eject

So we need the podid of the pod to eject, this information can be get trough the pod service

$services1.pod.Pod_List()

I want to eject the pod from pod2cbr1

$pod=$services1.pod.Pod_List() | where {$_.displayname -like "*pod2cbr1*"}

and with $pod I can check if I have the correct one

So let’s serve the eviction notice to the pod.

 $services1.PodFederation.PodFederation_Eject($pod.id)

No feedback, nothing but if we check the pod list it’s gone.

I will show how to remove the remnants in the uninitialize chapter.

[sta_anchor id=”update” /]

Updating a Pod Federation

This one sounds bigger then it is since there’s only one thing that we can update in a federation. To do this it is better to use the helper service then to use the podfederation_update method since that can get complicated very fast sometimes. To use the helper service we will need to create some variables first

$podservice=new-object vmware.hv.podfederationservice
$podservicehelper=$podservice.read($services1)

and when we do a get method on it

After some trial and error I know we need to getdatahelper method to continue

This only show the updates that are currently in the queue to be applied with a get method it’s possible to see what can be set.

$podservicehelper.getDatahelper() | gm

What we need to look for is a set so the only options here are setdisplayname that needs a string value and setupdates that needs a load of information and that probably might also be a way to do it but I will use the setdisplayname.

$podservicehelper.getDatahelper().setdisplayname("Whatever name you like")

This will give no feedback and nothing will be changed yet, what needs to be done is to apply this update in the helper service to the service.

$podservice.update($services1, $podservicehelper)

and if you now do a get on the podfederation it will show the changed name.

[sta_anchor id=”Unintialize” /]

Uninitializing a Podfederation

To show the pod uninitialization step I will use the pod that I have ejected from the podfederation pod2cbr1. It is clear that it is a bit wonky if we look at the pod list from that connection server.

So it knows about the pod federation but doesn’t see itself in it anymore.

$services1.PodFederation.PodFederation_Uninitialize()

This is again a fast one so I couldn’t get it visible in the admin console but when checking the data from a get it shows it has been disabled.

Looking from the other pod it still shows the Podfederation as enabled.

No github scripts this time since I will be adding this functionality into the vmware.hv.helper module.

Remove desktop assignment

In this blogpost I showed how to assign a certain vdi machine to a user. This has been made easier since in the vmware.hv.helper module. These days we can use this:

get-hvmachine -machinename MACHINENAME | set-hvmachine -user USER@DOMAIN

This week I got the logical question from Brandon Smith in the comments about removing the assignment. First I need to re-assign the desktop (I have been building a VMUG presentation about PowerCLI & Horizon view so things got messed up)

the result:

Now what need to be done is setting the base.user to $null. I am going to do this by connecting to the machine service and utilize the machinehelper to update the userdata.

$machineservice=new-object vmware.hv.machineservice

We now need to connect to the machinehelper by doing a read on the machineservice. $machineservice.read will give us the info we need to be able to do this.

From this it becomes clear that we will need the services service and the machineid we want to edit. First let’s put the machine id into a variable.

$machineid=(get-hvmachine -machinename MACHINENAME).id

Now I will read the properties of this machineid and put this into the $machineinfohelper variable

$machineinfohelper=$machineservice.read($services1, $machineid)

Since I know the user property is under the base we will need to get the base first and then set the user. This done by doing getbasehelper() on the machineinfohelper and then do .setuser(user) on that but let’s see what’s under the getbasehelper first.

$machineinfohelper.getbasehelper() | gm

A lot of information but as said the one we need is setuser. To assign a desktop we will need to set this to a userorgroupid value (and that is what the vmware.hv.helper cmdlet does). To clear it we will need to set it to $null.

$machineinfohelper.getbasehelper().setuser($null)

At this point no changes have been made yet! We will need to apply this update first.

$machineservice.update($services1, $machineinfohelper)

And if we look at the horizon console the entitlement has been removed.

And the complete script:

$hvserver1=connect-hvserver connectionservername
$services1=$hvserver1.extensiondata
$machinename="MACHINENAME"
$machineid=(get-hvmachine -machinename $machinename).id
$machineservice=new-object vmware.hv.machineservice
$machineinfohelper=$machineservice.read($services1, $machineid)
$machineinfohelper.getbasehelper().setuser($null)
$machineservice.update($services1, $machineinfohelper)

As usual the script can be found on github.

The VMware Labs flings monthly for March 2018

So how was your april fools this year? I bet a lot of children have been looking for eggs that where never hidden. Luckily I got away with only a couple of good jokes by my kids. On the VMware flings front there are no new flings but seven have received one or more updates or more exact six have received an update and one has received a couple. The Cross vCenter Workload Migration Utility received it’s first update and for the App Volumes Utility it was several months ago. Besides those the Cross vCenter VM Mobility – CLI, HCIBenchVMware OS Optimization ToolvSphere HTML5 Web Client and ESXi Embedded Host Client also received updates.

[sta_anchor id=”appvolbck” /]

App Volumes Backup Utility

The App Volumes Backup Utility is one of the few ways to backup those writable volumes. Friends don’t let friends use them but if you do please make sure you have backups.

Version 2.1

  • Added missing pre and post backup prep files

[sta_anchor id=”xvcmu” /]

Cross vCenter Workload Migration Utility

This is the graphical tool to move vm’s between vCenter servers. If you prefer a command line way please use the tool below.

Version 1.1.0, March 30, 2018

  • Added a detailed task info view for migration tasks
  • Fixed an issue with site name containing “DOT” characters
  • Display VM resource (CPU, Mem, Disk) info
  • Add a button to clear selected inventory data

[sta_anchor id=”xvccli” /]

Cross vCenter VM Mobility – CLI

This is the CLI way to move those vm’s between linked or not linked vCenter servers. If you prefer something visual then please use the tool above.

Version 1.6

  • Added support for bulk-relocate / bulk-clone which helps the user to migrate / clone multiple VMs specifying various destination locations in a single command.
  • Added support to choose destination resource pool

[sta_anchor id=”osot” /]

VMware OS Optimization Tool

Some use scripts, some use other tools but for me the OSOT is the preferred method to optimize my golden images.

March 30, 2018

  • [Template] Issue fix – DELETEVALUE actions do not do anything
  • [Template] Issue fix – DISM commands missing /NoRestart switch
  • [Tool] Issue fix – Switching to another tab loses all unsaved changes
  • [Tool] Enhancement – Simplify user interaction in Template Editor. Now editing template no longer requires repeated Update button click. Mac style editing is applied (Automatically save changes along with edit)

[sta_anchor id=”hcibench” /]

HCIBench

What is there to say about the HCIBench benchmarking tool for Hyperconverged Infrasturctures

Version 1.6.6.

  • Spectre & Meldown patch on both HCIBench VM and Client VM
  • Added client VM prefix field, allow running multiple HCIBench instances against single cluster
  • Attach testing log along with testing results
  • Enabled live vSAN Observer when running testing, using https://HCIBench_IP:8010
  • Updated the drop read/write cache script
  • Added more message info during the testing
  • Bug fixes

[sta_anchor id=”vchtml5″ /]

vSphere HTML5 Web Client

A couple of updates for the vSphere html5 client, more and more features are being added so it will end on par with the flash client.

Fling 3.36 – Build 8111348

New Features

  • Customize additional hardware devices/options during VM creation or cloning:
    • Host USB device
    • SCSI controller
    • USB controller
    • SATA controller
    • CPU > CPUID Mask > Advanced
    • VM Options > VMRC options
    • VM Options > VMware Tools > Power Operations
    • VM Options > Power Management > Wake up on LAN
    • VM Options > Advanced Configuration Parameters
    • VM Options > Fibre Channel NPIV
  • Warn when about to perform an operation on VM template(s) managed by a solution

Bug Fixes

  • SSO authentication error during accessing the vSphere Client from the fling appliance is resolved
Fling 3.35 – Build 7914771

Improvements

  • UI improvements on Quick search including
    • Search dropdown design is changed to show the top 10 results
    • View all results page design is modified to show grouping in the object navigator and the results in the right pane
  • UI improvements in grouping of hard disks in Edit Settings and VM Summary. If there are more than 4 harddisks for a VM, you will see them grouped in Edit settings. This enhancements will improve the performance of the VM Edit Settings.

[sta_anchor id=”#esxiclnt” /]

ESXi Embedded Host Client

This should eb installed on your ESXi hosts by default by now but ESXi embedded host client is  getting updates trough this channel.

Version 1.29.0 build 8122819 (Fling 20) – March 28, 2018
  • General
    • Reset selection on vm deletion
    • Fix issue with datastore wizard on very large datastores
    • Update available rdm disk list in vm wizard
    • Correct miscalculation of datastore total in wizard
    • Better support for NSX networks
    • Fix clicking issues on full-screen and new tab console screen
    • Prevent password maangers from autofilling optional field on login page.
    • Minor bug fixes and cosmetic changes

I have been awarded VMware vExpert once again: the vCommunity rules!

After having lots of fun in the vExpert Slack channel last evening with everyone waiting for the vExpert 2018 announcements I decided to had to bed not too late. This morning I woke up with this in my inbox:

So this is my third year in a row that I have been awarded VMware vExpert. Those three years have been a thrill ride. I started blogging mid 2016 after doing my first (and somewhat failed) vmug presentation at the Dutch VMUG. Things really picked up after I was awarded my 1st vExpert in the 2nd batch of 2016, my blog started to get more views, I created more content and I found my home in a community that simply rules: the vCommunity!

While sometimes harsh words are spoken my general feeling of the vCommunity is one of camaraderie. No question is too stupid, no solution is to weird, there are always people willing to help you with whatever is going on. This is not only true for the vExpert slack channels but also those of Nutanix, VMware Code, IOPros and last but not least the vExpertEUC channel. Most of the times things are very serious but every now and then the channels buzz with that Friday afternoon feeling where no-one is safe for jokes. When going to events meeting up with all of these people is always fun. If it is at a vmug, VMworld or EUCtechcon there’s almost almost immediate chemistry between people who just enjoy sharing and caring.

So I want to thank all of the vCommunity that have made this possible for me and I look forward to speaking to you whether it’s in person, twitter, slack or some webex. Without all of you this wouldn’t have been half as much fun!!

Presenting at the Dutch VMUG UserCon

In two weeks time I will be presenting at the Dutch VMUG UserCon, the biggest VMUG in the world! For the 3rd consecutive time I will be taking the stage by storm. My first try, about problems I encountered in the field, was a disaster but I learned lots and got good feedback from lots of people including my very good friend Hans Kraaijeveld. The second year I decided to get Hans on stage as well because he already thought he knew it all so we presented about our favorite flings for Horizon View last year. I repeated that presentation on my own at the German VMUG later that year where I had a bit more time so I could actually show the tools instead of clicking trough a powerpoint like we had to do in in the 20 minutes we had in The Netherlands.

This year I will be on my own again on stage talking about PowerCLI & Horizon View. For the regulars on that will certainly not come as a surprise. Lots of it will be pre-recorded demo’s since I don’t want to bore the people with ten minutes of typing errors. Sadly I am placed at the end of the day so I hope the audience will not be too tired. I have competition from someone called Duncan Epping, you might have heard of him. Looking at the agenda it’s a star studded day anyhow so it’s hard getting a slot without very good competition.

So do I see you at the dutch vmug? Most of the presentations will be in dutch but we can still have fun though!

The VMware Labs flings monthly for February 2018

It’s already March 1st and that gives me just a bit over 2,5 weeks to prepare for my session at the Dutch VMUG Usercon, the biggest in the world! ALso it has a Hackathon this year the day before + lots of VMware R&D sessions to choose from and last but not least a VCDX workshop. But back to flings, there have been three updated an no new flings this month. First there is almost as always the vSphere HTML5 Web Client. Further both DRS Lens and the Cross vCenter VM Mobility – CLI flings have received updates. Also a special mention for a fling that has gone GA: PowerCLI Core is now embedded in PowerCLI 10.0.0 that was released yesterday!!

[sta_anchor id=”cvvmc” unsan=”CVVMC” /]

Cross vCenter VM Mobility – CLI

Need to move workloads between vCenter’s that are linked or not linked? This fling will help you doing that from the commandline.

Changelog

Version 1.5

  • Added support to choose destination vm folder / destination storage pod (storage drs)

[sta_anchor id=”drslens” /]

DRS Lens

The DRS Lens fling has been created to give it’s user insight in why DRS migrations take place. It provides information on vMotions, Cluster Balance and more.

Changelog

Version 1.2

  • Added support for archiving monitored data
  • Added vCenter level summary page, to get summary of clusters and archives
  • Fixed Bugs reported in v1.1
  • UI enhancements

[sta_anchor id=”html5″ /]

vSphere HTML5 Web Client

Yes this fling also needs an introduction but what else can I say that this is the latest and greatest in managing your vCenter?

Changelog

Fling 3.34 – Build 7758187

New Features

  • Distributed switch topology diagram
  • Batch creation of VMkernel network adapters on a distributed port group
  • Assign License action on the License Assets tabs
  • Notification message for expiring VC licenses
  • Edit vApp settings
  • Enable and edit vApp options on a VM
  • Move networks and distributed switches to network folders

New vmware.hv.helper cmdlets (also looking for ideas!)

It’s already a couple of weeks ago that the pull request was merged but I managed to build a couple of new functions for the vmware.hv.helper module. Besides these I am also always looking for new functions to add and since I keep forgetting them I create a project on my own fork of the PowerCLI-Example-Scripts. That can be found here: https://github.com/Magneet/PowerCLI-Example-Scripts/projects/1 so if you have any requests or good ideas for functions please send them my way or add them yourself off course 🙂

This was recently done after my pr’s or is still open to be merged:

New functions

  • reset-hvmachine
    • Resets machines
  • get-hvlocalsession
    • Gets all sessions for the local pod
  • get-hvglobalsession
    • Gets all global sessions + the sessions directly to the local pod

Changed functions

  • get-hventitlement
    • had some issues with groups
  • add-hvdesktop & add-hvrdsserver
    • removed the displaying of the vcentervm id that was added to the pool
      • PR done, not yet merged!

Removed Functions

  • get-hvpodsession
    • this only got a sessioncount so hardly any usefull data

What gets you in the creative mood?

Not a technical post this time but a short one about creativity. Do you know that feeling that there’s an awesome idea in your head  brewing for a post but that you somehow can’t get yourself going to write it up?  I used to have this when writing reviews for fok.nl and still do sometimes when writing blogs on this site. While most of the times setting myself to it will get me in the right mindset that doesn’t always help. Sometimes there’s just too much noise around in my house or all kinds of distractions around the house (adhd anyone?). Most of the times it’s my kids watching something and they just can’t sit still on their chairs (again: adhd). Trying to get them quiet is sheer impossible and noise cancelling headphones will allow just enough sound trough for them to still be annoying.

The one thing that almost always gets me going is music! And I don’t even need that noise cancelling headset for that, just having a tune in my head or playing it on my phone can be enough. Lately one of my favorites have been Alestorm but other bands have been able to get me on the creative track. Queen, Pink Floyd, Metallica, Epica or DJ Tiesto are some of the other names I have had success with in the past. The question always is what band/artist I need to pick to get me going, this totally depends on how I am feeling but the first that pops into my head to play mostly is ok.

My current favorite to get me going (and that inspired me to this short post):

 

So the big question is: What get’s you in the right mood for creativity?

The VMware Labs flings monthly for January 2018

It’s that time of the month again with the update flings from VMware labs. In January seven flings received an updated while no new flings have been released, it can’t have a launch party every month can we? Six familiar names with the vSphere HTML5 Web Client, Desktop Watermark, Horizon Toolbox, HCIBench, Blockchain on vSphere and the OS Optimization tool plus the lesser updated (last update august 2016) DoD Security Technical Implementation Guide(STIG) ESXi VIB.

[sta_anchor id=”stig” /]

DoD Security Technical Implementation Guide(STIG) ESXi VIB

This one is for the people who have to implement a very high security on their vSphere environment. Please read the changelog, no STIG has been released yet for vSphere 6.5! Since it’s a lesser updated one I will give you the complete description from the fling site:

The DoD Security Technical Implementation Guide (‘STIG’) ESXi VIB is a Fling that provides a custom VMware-signed ESXi vSphere Installation Bundle (‘VIB’) to assist in remediating Defense Information Systems Agency STIG controls for ESXi. This VIB has been developed to help customers rapidly implement the more challenging aspects of the vSphere STIG. These include the fact that installation is time consuming and must be done manually on the ESXi hosts. In certain cases, it may require complex scripting, or even development of an in-house VIB that would not be officially digitally signed by VMware (and therefore would not be deployed as a normal patch would). The need for a VMware-signed VIB is due to the system level files that are to be replaced. These files cannot be modified at a community supported acceptance level. The use of the VMware-signed STIG VIB provides customers the following benefits:

  • The ability to use vSphere Update Manager (‘VUM’) to quickly deploy the VIB to ESXi hosts (you cannot do this with a customer created VIB)
  • The ability to use VUM to quickly check if all ESXi hosts have the STIG VIB installed and therefore are also in compliance
  • No need to manually replace and copy files directly on each ESXi host in your environment
  • No need to create complex shell scripts that run each time ESXi boots to re-apply settings

Changelog

Update January 2018

Added 6.5 STIG VIB to the downloads section. **Please note this is not based on a DISA STIG as a 6.5 STIG has not been released**

[sta_anchor id=”osot” /]

VMware OS Optimization Tool

No need to say a lot about this fling. If you need to optimize a windows system this has been the goto tool for years.

Changelog

January 4, 2018

  • Issue fix: Can not access public templates

[sta_anchor id=”blockchain” /]

Blockchain on vSphere

Want to build & test blockchain applications? This might be a handy tool in your toolbox for that.

Changelog

Jan 15 2018, BoV 1.1

  • Designed to run on PKS(Pivotal Container Services), and validated in PKS Beta
  • Integrate Blockchain Explorer into BoV which makes it easier to view/monitor peers, transactions, etc
  • Enhance BoV to support saving blocks and channel data to persistent volume
  • Optimize the installation process
  • Provide a default channel for blockchain applications
  • Update Fabric to 1.0.5

[sta_anchor id=”hcibench” /]

HCIBench

Specially build to benchmark VSAN clusters but can be used to test any HCI.

Changelog

Version 1.6.5.2

  • Added case comparisons by generating an XLS file for each test folder
  • Fixed bug when there’s white space in datastore name or test name

[sta_anchor id=”toolbox” /]

Horizon Toolbox

Missing anything in the (crappy) Horizon? There is a chance that it might be in this tool!

Changelog

2018 Jan 18

  • Horizon 7.4 support
  • Some bug fixes

[sta_anchor id=”watermark” /]

Desktop Watermark

Do you want to be sure one of your desktops is used for auditing. With this tool you can set an (in)visible watermark.

Changelog

Build 1127

  • This build is signed now.

Addition

  • Password protection for the configuration & uninstallation
    • was supposed to be added in the previous release as well so might be a copy/paste error

[sta_anchor id=”html5″ /]

vSphere HTML5 Web Client

Do I really need to add a description to this one? There is a html5 client build into vSphere these days but this version is updated very often and is becoming more and more on par with the (yuck) flash client.

Changelog

Fling 3.33 – Build 7616394

New Features

  • Support for PCI and Shared PCI devices for a VM
  • Create vApp wizard
  • Clone vApp wizard
  • vApp move to Host & Cluster
  • Duplicate a VM customization specification to another VC and with custom name/description
  • Synchronize Licenses action (former Import License Keys Data)
  • Assets’ details
  • Ability to edit VM Advanced configurations in Edit Settings of the VM
  • Change the shortcuts for Power Operations in VMware tools section in the Edit Settings of the VM
  • Change the maximum concurrent VMRC sessions for a VM in the Edit Settings

Bug Fixes

  • Can add an existing hard disk in Edit Settings for VM residing on datastore cluster

Known Issues

  • Creation of child vApp wizard is not working – the workaround is to create a child vApp as separate vApp and use move to operation to move it under the parent one.

Fling 3.32 – Build 7496117

New Features

  • vApp power operations
  • vApp move to operation to folder operation
  • vApp rename operation
  • vApp delete operation
  • vApp export to OVF template

Improvements

  • vApp related VMs tab, datastore tab and networking
  • Add Permission action on VM templates

New Year, new month, new job!

2018 already proved to become an awesome year for me. I became Nutanix Technology Champion again for 2018 and I also decided to change employers. While Detron has been a great employer for over three years it was time to change. My ambitions for what I wanted to do proved to be hard for them to match in jobs to do. I do have to thank them though for the great support I had in these years in which I started blogging, public speaking and managed to enter several community programs like VMware vExpert, Nutanix Technology Champion and more recently the newly announced Liquidware Tech Insiders started by former colleague and Liquidware Pre-sales Director Northern Europe Bas van Kaam.

Starting February first I will be joining TenICT in the Netherlands as VMware Consultant. This company was recently nominated as Most promising Partner of the year for The Netherlands by VMware. They also recently signed a VMware PSO contract so will be taking on PSO jobs as well in the near future. In short it looks like it’s going to be an awesome 2018.

Again I want to thank Detron for the three great years I had with them and I will definitely miss the people and the fun we had!