New experimental functions for the vmware.hv.helper on github

While working on my presentation for the 2nd vEUCtechcon event in Utrecht (The Netherlands) on may 28th I have added a list of new functions to the vmware.hv.helper module. While I haven’t had the time yet to clean them up to be proper coded scripts I have decided to already publish them on Github. All of them work but might be missing a feature or two and almost all of them are get-hv* or new-hv* type functions. Since the presentation is all about building an environment I have decided to build the remove parts later on. You might have already seen some screenshots on twitter recently:

Added functions that are not in the official module yet:

  • register-hvvirtualcenter
  • set-hveventdatabase
  • set-hvlicense
  • get-hvlicense
  • new-hvinstantcloneadministrator
  • New-HVRole
  • Get-HVRole
  • Get-HVpermission
  • New-HVPermission
  • Get-HVVirtualcenter
  • Get-HVInstantCloneAdministrator
  • Get-HVPod
  • Set-HVPod
  • Get-HVHomeSite
  • New-HVHomeSite

 

Wouter’s five vCommunity tips for visiting VMworld

While this year will only be my third visit to VMworld I still think I have some tips to share with the vCommunity. Yes offcourse you need to keep hydrated all the time, have good footwear and don’t party to hard if you have sessions early in the morning but there’s more to VMworld then just that: the vCommunity itself!

Tip 1 : engage strangers

This his already been said at other blogs but don’t be afraid to engage strangers in conversation. If you hear a good conversation going on, don’t be afraid to listen to it, ask questions or even voice your own opinion. If you do this politely no-one will think badly of you. This also counts when heading our for breakfast or lunch, only take a seat at an empty table if you have to. I have made some good contacts after just joining them at their breakfast table. This also counts for the evening parties, I prefer the ones where you can actually have a decent conversation above those where you need to shout to understand each other.

Tip 2 : Join the Hackathon

You don’t need to be an experienced coder or scripter to join the hackathon. Last year I had an almost complete noob (Sorry Hans!) at my team and at the end of the evening he was able to create a small script of his own. This makes him stand very high on my ranking above people who are very experienced and only do their usual trick but just a bit different. Also don’t be afraid that you might make a mistake, we all do all the time and it’s the best way to learn how those script you might have partially copied from the internet actually work.

Tip 3 : Visit the community booth & area

For me both previous years the community booth and the area around it where the highlights of the show. Not only is there awesome content to be found at the communities/vBrownbag theatre, it also seems to be the place where lots of smart people gather to drink a coffee, have fun and share knowledge. This year there it will have an even greater presence with the addition of another theatre for VMware {code}!!

Tip 4 : look for the smaller stands at the solution exchange

You probably already know most of the big brands showcasing their latest and greatest at the solution exchange. To the sides at the smaller and simpler booths you might find some startups that might have a new and awesome product that you didn’t know yet. There’s a good chance you might find a vcdx or vExpert at these booths that really know what they are talking about.

Tip 5 : join the UX Design studio sessions

You might have met them already at your local VMUG but did you know that they also had feedback sessions during both VMworlds in 2017? In these small and sometimes one on one sessions you really have the chance to have an impact on future products of VMware. I did several last year and these where really good. It’s their job to listen to you while you think out loud about how something looks. This can be in the form clicking inside an actual product, powerpoints with visuals or even drawings that they came up with recently.

Bonus tip: be selective on the swag

If you go all out on swag this will fill up your suitcase pretty damn quick and you will come home with at least 60% junk that ends up in the bin because it’s unusable or already broken. So be picky on the shirts and socks you accept, why accept it if you wouldn’t want to wear it anyway? Also make sure to bring some rubberbands to roll the shirts in. I was picky my first two times but still managed to fill up a suitcase each time, just look at the pictures below.

VMworld US 2016:

Top right is a stack of 17!! t-shirts almost all rolled up

VMworld EU 2017

This time I didn’t really roll those shirts.

 

Hopefully I will see you at VMworld!

The VMware Labs flings monthly for May 2018

It’s June already, time flies when you are having fun right? This month there have been three new and five updated flings. In the category new there is an ESXi Compatibility checker, DRS Entitlement viewer and the Cellular Module User Space USB Driver on ESXi. In the updated category we have the eternal HTML5 vSphere web client, I/O Analyzer, Desktop WatermarkCross vCenter Workload Migration Utility and last but not least Blockchain on Kubernetes.

[sta_anchor id=”esxicompatchk” /]

ESXi Compatibility Checker

This is a new fling that makes it easier to check if you’re hardware is still supported by VMware. It does require python to be installed.

The ESXi Compatibility Checker is a python script that can validate VMware hardware compatibility and upgrade issues of ESXi.

VMware hardware compatibility and product interoperability need to be validated when new hardware is installed on an existing ESXi or when a VC/ESXi version needs to be upgraded. Unfortunately, it is not a trivial task as the compatibility information is scattered in multiple web pages. The user needs to understand the data and validate them one by one manually. This process is tedious, laborious and often prone to error when done at scale.

This Fling will provide a simple and easy way to collect server and IO device details from ESXi and provide a command line interface to validate their VMware compatibility and upgrade issues. Users no longer need to understand compatibility details or manually compare the dataset to find out compatibility or upgrade issues. The Fling can generate a compatibility report for many ESXi managed by a VC with a simple command.

Changelog

  • first release May 15, 2018 v1.0 – Build 8532763

[sta_anchor id=”drsentitlement” /]

DRS Entitlement Viewer

This HTML5 client plugin shows entitled resources per VM and resource pool.

DRS Entitlement Viewer is installed as a plugin to the vSphere client. It is currently only supported for the HTML5 based vSphere client. Once installed, it gives the hierarchical view of vCenter DRS cluster inventory with entitled CPU and memory resources for each resource pool and VM in the cluster.

Entitled resources can change with VMs’ resource demand and with the VM’s and resource pool’s reservation, limit and shares (RLS) settings. So, customers can get the current entitlements based on the VMs’ current demand and RLS settings of the VMs and resource pools.

DRS Entitlement Viewer also provides 3 different What-If scenarios,
1. Changing RLS settings of a VM and/or resource pool
2. What-If all the VMs’ resource demand is at 100%
3. Both 1 and 2 happen together

Customers can pick one of the 3 scenarios and can get new entitlements without actually changing RLS settings on the cluster.

Finally, DRS Entitlement Viewer also provides an option to export the new RLS values from a What-If scenario as a vSphere powercli command which customers can execute against their vCenter to apply the new settings.

Changelog

  • First public release May 29, 2018 v1.0.2

[sta_anchor id=”cellmodule” /]

Cellular Module User Space USB Driver on ESXi

The Cellular Module User Space USB Driver on ESXi provides you with a driver so you are better able to use a cellular module form ESXi.

IoT is growing rapidly so many users would like to enable ESXi on their IoT devices. Driven by VMware’s virtualization technology, which can help them address some challenges like security issues, fragmentation, multi-tenancy, etc. The reality is that many of those IoT devices have a variety of devices and busses that ESXi does not support. The Cellular Module is one of those devices in the case of IoT. Typically, these devices have to communicate with their own remote management center.

This Fling provides a driver to enable deployment on ESXi on their IoT devices. Note that this driver is running in UserSpace mode. While many widely used IoT Edge Gateways are equipped with a cellular module, ESXi does not have a driver to activate that cellular module. So our cellular module userspace USB driver can enable that hardware module to communicate with a remote cloud server.

Changelog

  • First release May 07, 2018 v1.0

[sta_anchor id=”html5″ /]

vSphere HTML5 Web Client

The fat client’s already gone, the flash client is on its way out so better get used to the vSphere HTML5 Web Client!

Changelog

Fling 3.38 – Build 8535804

New Features

  • Guest OS User Mappings for VMs
  • Serial port support for VMs
  • Improved search including
    • New redesigned search results page
    • VM search results has filters such as power state, guest os, host, clusters, datacenter
    • Save search

Improvements

  • VM Quick power operations

[sta_anchor id=”ioanalyzer” /]

I/O Analyzer

The I/O Analyzer doesn’t get a lot of updates so you might not have heard of it. Like the names says it’s a very usable tool to test your storage performance.

VMware I/O Analyzer is an integrated framework designed to measure storage performance in a virtual environment and to help diagnose storage performance concerns. I/O Analyzer, supplied as an easy-to-deploy virtual appliance, automates storage performance analysis through a unified interface that can be used to configure and deploy storage tests and view graphical results for those tests. I/O Analyzer can use Iometer to generate synthetic I/O loads or a trace replay tool to deploy real application workloads. It uses the VMware VI SDK to remotely collect storage performance statistics from VMware ESX/ESXi hosts. Standardizing load generation and statistics collection allows users and VMware engineers to have a high level of confidence in the data collected. Please post comments and questions regarding this fling to the I/O Analyzer Community.

Features

  • Integrated framework for storage performance testing
  • Readily deployable virtual appliance
  • Easy configuration and launch of storage I/O tests on one or more hosts
  • Integrated performance results at both guest and host levels
  • Storage I/O trace replay as an additional workload generator
  • Ability to upload storage I/O traces for automatic extraction of vital metrics
  • Graphical visualization of workload metrics and performance results

Changelog

New in version 1.6.2u1

  • Support vSphere 6.5 onward
  • Upgrade to OpenSSL 1.0.2o
  • Hot patch script to live upgrade existing 1.6.2 VMs

[sta_anchor id=”watermark” /]

Desktop Watermark

Desktop Watermark is a tool that adds a visible or invisible watermark to a VDI Desktop. This can be used for auditing for example.

Changelog

Build 20180510

  • Added support for multiple monitors.

[sta_anchor id=”xvcenterutil” /]

Cross vCenter Workload Migration Utility

I used the Cross vCenter Workload Migration Utility myself this week when I wanted to clone my golden image to the not linked vcenter servers in my lab. Yes it can also clone besides just moving the servers. I might end up putting up a seperate blog post about this.

Changelog

Version 2.0, May 4, 2018

  • Added support to select individual host as the placement target
  • Added support for migrating VMs with shared datastore
  • Added clone functionality in addition to relocate
  • Added resource summary details for placement targets
  • Added a prompt to verify site thumbprint during SSL verification
  • Added a link to refresh vm list in the inventory view
  • Updated REST APIs to add operation type parameter

[sta_anchor id=”blckchnkbrnts” /]

Blockchain on Kubernetes

Not a blockchain person myself (yet) but this is the former Blockchain on vSphere fling that has been renamed to Blockchain on Kubernetes

Blockchain is an emerging technology which has been gaining traction globally throughout the past few years. Industries like finance, logistics, and IoT are actively working on research and pilot projects using blockchain.

Fabric is a sub project under Hyperledger (a LinuxFoundation project), it is probably the most mature blockchain solution available now for business use cases.

The mission of Blockchain on Kubernetes (formerly named Blockchain on vSphere) is to provide an end-to-end blockchain solution, from IaaS, to Blockchain platform and Blockchain applications. It allows organizations to quickly collaborate and evaluate the new business models and processes by using the decentralized blockchain technology.

By using BoK, blockchain developers can use BoK command line tool or a GUI tool provided by BoK PCF Tile to quickly set up an environment to build and test their blockchain applications.

Changelog

May 3 2018, BoK 2.0

  • Provide a new PCF Ops Manager Tile to deploy Hyperledger Fabric. It supports creating Kubernetes cluster via PKS Tile and deploy Hyperledger Fabric in the Kubernetes cluster.
  • Add a central config file bok.yml to specify all BoK configuration. No more manual code change is needed.
  • Support kafka as consensus mode.
  • Other enhancement for stability.
  • Verified against Kubernetes 1.9.7.

Registering an Instantclone administrator using PowerCLI

Another question Sean Massey asked me if it is possible to register an instant clone domain administrator. This is possible using the instantcloneenginedomainadministrator service with the InstantCloneEngineDomainAdministrator_create method. This needs a spec with the following content:

  • spec (vmware.hv.InstantCloneEngineDomainAdministratorSpec)
    • base (vmware.hv.InstantCloneEngineDomainAdministratorBase)
      • username (string)
      • domain (domainid)
      • password(vmware.hv.securestring)

The password can be created using the same scriptlet I used to register a new vCenter server. The domain ID can actually be gotten by listing all domains using

$services1.ADDomain.addomain_list()

For now I have created a scripts that requires you to give some details so it can register the instant clone domain administrator. It can also be found on Github but I will also definitively add it to the vmware.hv.helper module.

$icausername=read-host "What username to use for instantclone administrator?"
$icadomain=read-host "please give the dns name for the domain to user (i.e. domain.com)"
$icapassword=read-host "vCenter User password?" -assecurestring
$temppw = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($icaPassword)
$PlainicaPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($temppw)
$icadminPassword = New-Object VMware.Hv.SecureString
$enc = [system.Text.Encoding]::UTF8
$icadminPassword.Utf8String = $enc.GetBytes($PlainicaPassword)
$spec=new-object vmware.hv.InstantCloneEngineDomainAdministratorSpec
$spec.base=new-object vmware.hv.InstantCloneEngineDomainAdministratorBase
$spec.base.domain=(($services1.ADDomain.addomain_list() | where {$_.DnsName -eq $icadomain} | select-object -first 1).id)
$spec.base.username=$icausername
$spec.base.password=$icadminpassword
$services1.InstantCloneEngineDomainAdministrator.InstantCloneEngineDomainAdministrator_Create($spec)

Honoured to be named VMware EUC Champion 2018

You might have seen the announcement on the VMware EUC blog, Twitter or the new EUC Champions page already but I have been named one of the VMware End-User Computing (EUC) Champions for 2018. It is an honour to be awarded this status that only a select few receive each year. For me it feels like a true recognition for the work I have been doing with the Horizon API’s and my activity in the broader (EUC) vCommunity.

What is the EUC Champions Program?

EUC Champions is an experts-only program designed to provide a forum where the end-user computing community and VMware EUC product groups come together and share new product information and ideas through in-person meetings, networking events, industry conferences and webinars. This interaction helps ensure VMware EUC experts receive the most up-to-date information, and VMware product teams hear from industry veterans.

Thought leadership is easier said than done. It takes hard work and an ear to the ground to stay on top of industry trends. Many of our 2018 VMware EUC Champions have been thought leaders for decades, while others are rapidly becoming the go-to experts in their respective area. Whether new or returning, this year’s champions are among the ranks of end-user computing experts, who have done the work, made the commitment and signed up for more of the same in 2018.

What are the requirements to become an EUC Champion?

Not everyone is cut out to be an EUC Champion. It takes deep VMware EUC product expertise, an ability to write about it, a willingness to voice your opinion and the talent to clearly and concisely communicate ideas. EUC Champions are respected by their peers and, most importantly, are respectful of others.

Specifically, we look for candidates that meet the following criteria:

  • Member of the vExpert Program
  • Recognized EUC expert
  • Well regarded member of the greater EUC community
  • Recommended group member

Who are the 2018 EUC Champions?

On the new page there is a nice overview of all 34 EUC Champions

https://www.vmware.com/euc-champions/current-champions.html

Pulling horizon session information using PowerCLI

I should’ve already posted a blog about this but better late then never. At the end of february I posted about several new functions being added to the vmware.hv.helper and two out of three where about pulling session information. Recently I received some questions about using those since it’s the raw data being returned. For my Dutch vmug presentation I used several gif’s that showed what you can do with that data. I might need to update the cmdlets so all information will be shown at once but that’s for another time since it might slow down the cmdlet a lot and I don’t like that.

Usage

Since get-hvglobalsession and get-hvlocalsession show almost similar data I will only show the latter one.

get-hvglocalsession

As you see this only shows the methods contained inside the session. We can show the content by pipelining it to  select-object -expandproperty but I prefer the bracket method since these might go several layers deep.

(get-hvlocalsession).namesdata

Some of the returned values are logical like the username, machineorrdsservername. The desktop name though is the actual desktop pool the user is connected to. Desktoptype can be Automated, Manual or RDS depending on the type of desktop and Desktopsource can be Virtual_Center (VM’s hosted on vCenter but not managed by Horizon or Full Clone desktops), View_Composer(when using Linked Clones), Instant_Clone_engine (when using Instant Clones), Unmanaged (physical machines, non-vCenter vm’s) or RDS (Terminal Servers). Farmname will be used when it’s an RDS session. The Securitygateway will show the Connection Server the user connected to or the UAG/Security server used.

the same can be done with referencedata and sessiondata

(get-hvlocalsession).referencedata
(get-hvlocalsession).sessiondata

Not a lot of directly usefull information but a bunch of id’s that you might be able to use with the api’s if needed.

A lot of information about the session itself.

The actual code

The get-hvglobalsession actually is a query repeated for all pods. First it connects to the query service and then creates a query to run against each pod and add that to a sessionlist.

$query_service_helper = New-Object VMware.Hv.GlobalSessionQueryServiceService
$query=new-object vmware.hv.GlobalSessionQueryServiceQuerySpec

$SessionList = @()
foreach ($pod in $services.Pod.Pod_List()) {
  $query.pod=$pod.id
  $queryResults = $query_service_helper.GlobalSessionQueryService_QueryWithSpec($services, $query)
  $GetNext = $false
  do {
    if ($GetNext) { $queryResults = $query_service_helper.GlobalSessionQueryService_GetNext($services, $queryResults.id) }
    $SessionList += $queryResults.results
    $GetNext = $true
  } while ($queryResults.remainingCount -gt 0)
    $query_service_helper.GlobalSessionQueryService_Delete($services, $queryresults.id)

}
return $sessionlist
} 

The get-hvlocalsession is almost the same, it just doesn’t need to foreach since it doesn’t have multiple pods to query.

 $query_service_helper = New-Object VMware.Hv.QueryServiceService
  $query = New-Object VMware.Hv.QueryDefinition

  $query.queryEntityType = 'SessionLocalSummaryView'
  $SessionList = @()
  $GetNext = $false
  $queryResults = $query_service_helper.QueryService_Create($services, $query)
  do {
    if ($GetNext) { $queryResults = $query_service_helper.QueryService_GetNext($services, $queryResults.id) }
    $SessionList += $queryResults.results
    $GetNext = $true
  } 
  while ($queryResults.remainingCount -gt 0)
    $query_service_helper.QueryService_Delete($services, $queryResults.id)
  

  return $sessionlist
  [System.gc]::collect()
} 

In both there is a do while because otherwise it will run into some restrictions about maximum amount of data to return.

The VMware Labs flings monthly for April 2018

It’s been a rather quiet month on the VMware flings front. No wonder with the vSphere 6.7 and other releases this month. Did you already test them? I have to say like vSphere 6.7 but it’s consider the numbering good as well, it wouldn’t have fit to be a 7.* release. One new fling with the PowerCLI for NSX-T Preview, two updated ones with the vSphere HTML5 Web Client and Cross vCenter VM Mobility – CLI. Another fling has gone GA in vSphere 6.7: VMFork for pyVmomi.

[sta_anchor id=”nsxtpowercli” unsan=”NSXTPowerCLI” /]

PowerCLI Preview for NSX-T

The one thing lacking for NSX-T was PowerCLI availability, this is solved with the release of the PowerCLI Preview for NSX-T fling. Please be aware that the fling still contains bugs and might even be considered an alpha release.

[sta_anchor id=”xvcvm” /]

Cross vCenter VM Mobility – CLI

Cross vCenter VM Mobility – CLI is the go to tool when you want to move vm’s between vCenter servers and don’t want to use the GUI fling. The versioning is a bit weird since we already had 1.6 and now they released 1.6.0.

Version 1.6.0

  • Relocate is failing with validation error “cln is missing”.

[sta_anchor id=”html5″ /]

vSphere HTML5 Web Client

Not sure what exact version of the html5 web client went into the vSphere 6.7 release but here you can find an overview of the functionality, don’t mind the url because the text clearly states it’s for 6.7. If you want an even more updated version or want to get used to it in vSphere 6.* then use the fling.

Fling 3.37 – Build 8313530

New Features

  • Add VM vApp option properties read-only view
  • SRIOV networking in clone wizard customize HW page

Improvements

  • Prevent the user from creating a GOSc spec with no specified timezone
  • Resize the migrate wizard to use the largest possible size based on VMware Clarity design standards

Bug Fixes

  • Drag and Drop VM to folder

 

 

Added functions in vmware.hv.helper

Last Saturday I created a pull request to add some new functionality to the VMware.hv.helper. Together with an older PR that was still open it received an okay on Sunday. This is a list of the functionality I have added:

  • Get-HVHealth
    • Shows the health information for the following services:
      • ADDomain
      • CertificateSSOConnector
      • ConnectionServer,EventDatabase
      • SAMLAuthenticator
      • SecurityServer
      • ViewComposer
      • VirtualCenter
      • Pod
  • new-hvpodfederation
    • Initiates the Cloud Pod Architecture.
  • remove-hvpodfederation
    • Uninitiates the Cloud Pod Architecture.
  • get-hvpodfederation
    • Shows information about the Cloud Pod Architecture.
  • register-hvpod
    • Registers a new pod in the Cloud Pod Architecture.
  • unregister-hvpod
    • Removes a pod from the Cloud Pod Architecture. This can either be gracefully or forced.
  • set-hvpodfederation
    • Sets the name of the Cloud Pod Architecture.
  • get-hvsite
    • Retrieves information about all sites in the Cloud Pod Architecture.
  • new-hvsite
    • Creates a new site in the Cloud Pod Architecture.
  • set-hvsite
    • Sets site properties within the Cloud Pod Architecture.
  • remove-hvsite
    • Removes a site from the Cloud Pod Architecture.

The next functionality on my list is to put the pod service methods from this previous post into functions.

Managing Pods in a Horizon View Cloud Pod Environment using PowerCLI & Api’s

After Pod Federations and Sites it is time to manage the actual pods. Let’s take a look at what we can do.

$services1.pod | gm

Looks like a short post to me since there’s onl Get, List and Update

[sta_anchor id=”get” unsan=”Get” /]

Pod_Get

Just like with site’s the get can be used in conjunction with a podid that might be gotten from somewhere else

$services1.pod.pod_get((($services1.site.site_list()).pods | select -first 1))

This selects the first podid listed when pulling all the pods from all sites and gets the information about that pod. We’ll see the same information when doing a list but just with all pod’s listed.

[sta_anchor id=”list” unsan=”List” /]

Pod_List

$services1.pod.pod_list()

Those endpoints are the connection servers in the pod. Let’s take a short detour and get the listing for one of those (the podendpoint service only has list and get so you will not see them separately anyway).

$services1.PodEndpoint.PodEndpoint_Get((($services1.pod.pod_list() | select -first 1).endpoints | select -first 1))

It might look lazy to use the select -first one and yes it is a bit but doing  a foreach to explain things also doesn’t really work in my opinion.

[sta_anchor id=”update” unsan=”Update” /]

Pod_Update

Standard by now, first we need to connect to the podservice.

$podservice=new-object vmware.hv.podservice
$podhelper=$podservice.read($services1, ($services1.pod.pod_list() | select -first 1).id)

Under $podhelper we can already see how to set things.

$podhelper | gm

Let’s update  the easy things.

$podhelper.setdescription("This is a new description")
$podhelper.setDisplayName("This is a new name")
$podservice.update($services1, $podhelper)
$services1.pod.pod_list()

As a result we have updated the name and description of the pod. The other thing we can do is assign the pod to another site. Thankfully I already have two of those created.

$services1.site.site_list()
$siteid=$services1.site.site_list() | select -first 1

$podhelper.setsite($siteid.id)
$podservice.update($services1, $podhelper)
($services1.pod.pod_list()).site
$services1.site.site_list()

Both the lists aren’t required but I added them to show that the pods are spread over both pods now.

 

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

$services1.site | gm

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.

[sta_anchor id=”list” /]

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.

$services1.site.site_list()

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

($services1.site.site_list()).base

($services1.site.site_list()).pods

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

[sta_anchor id=”create” /]

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.

$services1.site.site_create

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

$sitebase=new-object vmware.hv.sitebase
$sitebase.displayname="blogpostdemosite"
$sitebase.description="This is a blog demo site"
$sitebase

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

$services1.site.site_create($sitebase)

[sta_anchor id=”get” /]

Site_Get

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

$services1.site.site_get

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

$demosite=$services1.site.site_list() | where-object {$_.base.displayname -like "*blogpostdemosite*"}

And now we need to apply that to the site_get

$services1.site.site_get($demosite.id)

[sta_anchor id=”update” /]

Site_Update

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

$siteservice=new-object vmware.hv.siteservice

now what method’s do we see?

$siteservice | gm

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

$siteinfohelper=$siteservice.read($services1, $demosite.id)
$sitebasehelper=$siteservice.read($services1, $demosite.id)

Now let’s compare them.

$sitebasehelper | gm
$siteinfohelper | gm

 

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

$sitebasehelper.getbasehelper() | gm

$sitebasehelper.getbasehelper().setDisplayname("thissitecanberemoved")
$sitebasehelper.getbasehelper().setDescription("yes it can really be removed")

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

$siteservice.update($services1, $sitebasehelper)

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

[sta_anchor id=”delete” /]

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.

$services1.site.Site_Delete($demosite.id)

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