Creating and managing Sites in a Horizon View Cloud Pod Environment using PowerCLI & Api’s

Intro

Like I said in my previous post about Pod Federations this is a separate post that will show how to handle Sites within a Pod Federation. There are only a couple of API calls that do not include assigning a pod to a site. This is done trough the podservice which I will post about in a next blog post.

Let’s take a look at the site service to see what it actually has in api call’s

So we have Site_create, Site_delete, site_get, site_list and site_update. To Make it myself easy I will use the order of List, create, get, update and delete.

Site_list

With site_list a list of all available site’s will be created, currently I have only one so let’s show that one.

Note a lot of information is shown so let’s take a look at the contents of base and pods.

so again not a lot of information since it only contains a name, description and the pod id’s of the member pods.

Site_Create

Since we already saw in the methods under the siteservice that the create needs a bit more information then just a name let’s take a look again at what is required.

An object is needed of the type vmware.hv.sitebase, we will need to take a look in the API explorer to see what this object should contain. Under Site_create we can click on sitebase.

The sitebase object has 2 properties of which only DisplayName is required. I have tried various ways to keep the description empty but haven’t succeeded so far and with it it the create also doesn’t work so how optional is it?

Let’s create the sitebase object

The $sitebase is not required but shows what the object contains. Now we have enough to create the new site.

Site_Get

In the overview we have seen that a site_get needs a bit more information.

We already know how to get this site id by using site_list, normally you would only use the site_get with an id received from another service like the pod service. For the example I will use the demo site I create in the site_create part of this post.

First I will need to get the siteid

And now we need to apply that to the site_get

Site_Update

As said before for an update method it is better to use the helper service for that service.

now what method’s do we see?

To see the difference between the sitebasehelper and siteinfohelper I will create both objects.

Now let’s compare them.

 

This is again one of those wtf moments, they both do exactly the same! I will use the sitebasehelper for now will update both the Displayname and description. For this I will need to use the getbasehelper 1 step deeper

and apply the update, since neither will generate a response I won’t put any screenshots in.

Now let’s see the result for a site_get for this site now

Site_Delete

We can take a look at it but to delete a site we only need the siteid so let’s remove that site we gave an update.

again no visual feedback but if we do a sitelist there’s only one left.

 

 

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.

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.

Initialize the podfederation

Now to initiate the podfederation

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

Get information about the federation

With podfederation_get() we can grab the configuration information.

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

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.

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).

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

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

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.

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

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.

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

I want to eject the pod from pod2cbr1

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

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

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.

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

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.

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.

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.

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

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.

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:

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.

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.

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

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.

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.

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

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

And the complete script:

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.

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

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

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.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

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)

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

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.

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

{UPDATE]The Dutch VMUG UserCon was awesome!

Update: the video for my session can be found HERE (it is in Dutch!) or watched down below 🙂

 

I know I used it before but Ooooooooooooh what a rush where the last two days. It’s the day after when I am writing this but like I said on twitter I am still bouncing around after the Dutch VMUG UserCon. My own session went great and hopefully I can put the link to the video here very soon. What I can do is give you the slide deck I used and you can find it at the bottom of this post. The only thing I changed was that I added a translated disclaimer since I had way too much fun creating that one. I did create it as a parody of all the VMworld and .Next disclaimers and because I was in the last timeslot of the day and wanted to give the audience something to laugh when they walked in so they would stay awake after a tiring day at our mini VMworld.

disclaimer

Day one

Now about those two days, at the first day I was one of the three judges in our first (hopefully annual) Hackathon. We had three teams, two from partners: ITQ & PQR and one, that got dragged in by their TAM, from the customer side. PQR build a combination of VRA, home automation and Lego Mindstorms. They gave a voice command to a homey and the Lego Mindstorms robot showed the status of the new vm request while Ikea Tradiri would also show the status with a colored bulb. When a vm was rejected the robot dumped the bit the used as example in the bin aka off the table :D. Team ITQ wanted to deploy a PKS cluster by using giving an Amazon Alexa a voice command that in its turn used a slack channel as messagebus to get things deployed. Not everything worked perfect but in the end they were able to ask Alexa for a Minecraft server and a Steve webinterface would give visual feedback if it worked. As an easteregg Steve could also do a barrel roll. Team Dictu had a different use case, they are busy implementing VRA and their TAM though it was a good idea to get some practice at the Hackathon, they did end up deploying things after some waiting on the slow wifi. For me they were the winners for trying to do something almost new to them and getting results as well. That is why I gave them my personal spot price: a six-pack of Achelse Kluis Trappist beer. Overall, we decided not to have a real winner but everyone won as it should be. The theme of Fun, beer and Gyros fitted perfectly and together with everyone who was there I am sure we had an awesome time. Just next year I might think about creating a non-company but vCommunity team of all sorts to do some EUC stuff.

The swag table had some interesting stickers at the hackathon

During the day at day one there were also several VMware R&D sessions (NDA I believe) and a VCDX workshop. The R&D Sessions could use some more audience but the vcdx workshop was very full I believe. For me day one was already a huge success while day two was still coming.

Day two

Day two or more actually UserCon day. I must admit that I didn’t attend a lot of sessions but the keynote by no-one else then Pat Gelsinger was great. He did not get a lot of questions during the q&a part but it filled the time and he had to use the I cannot confirm nor deny that several times. Some of the sessions I attended where a NSX jumpstart for VDI by Pascal van de Bor, a security awareness session (marketed as security for EUC admins & Consultants) and some others. At 15.50h it was time for my own session that was in fact an introduction to PowerCLI for Horizon View. I managed to spoon-feed the audience 61 slides in a bit over 20 minutes without them even noticing it. I had 16 slides with static content including vmug, title, introduction and overview pages. The rest where simply moving gifs (without loops!) that I recorded using ScreentoGif. This allowed me to demo the functions and usage of the results without boring the audience with 10 minutes of typing errors by doing it manually. And yes, some things I had to do over 10 times to get it rights so it was worth doing it that way. I managed to get myself in a relaxed state by listening to some music (Katie Melua this time) while going through the deck one last time. During the presentation I hardly felt the nerves and even managed to keep my cool and not speak too fast like I did before. While last year with Hans it was a success this time was even better and I was really satisfied with the results.

You can find the final presentation here: https://wkursten.stackstorage.com/s/Y8hkexL8qDTXVVb it was built in Dutch but most are demos anyway.

I think these are my lucky socks now since I wore them during day 2.

 

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!!

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)

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

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?