PowerCLI – Configure VCSA update policy

It took me a little while to figure this one out, since I am new to this rest API thing and I find the old API documentation easier. On VMware’s homepage I was not able to find the API for vSphere 6.7, only 6.5.


However you can access the API explorer directly on the vCenter as described here.


Below you can find my little PowerCli code snippet.

## Connect to VCSA. You would think to use the root user but no, SSO user
# like administrator@vsphere.local.
$cisConnection = Connect-CisServer -server vcenter.txusa.cloud 

## I didn't know how to create an updateSpec object so I just
## got the existing one from VCSA and then will overwrite the parameters
$updateSpec = (Get-CisService -Name "com.vmware.appliance.update.policy").get()

## Set parameters for update policy
$updateSpec.auto_stage = $true
$updateSpec.auto_update = $false
$updateSpec.manual_control = $true 
$updateSpec.username = ''
## vSphere 6.7u1 now forces https
$updateSpec.custom_URL = "https://updaterepository.txusa.cloud/vcsa"
## Time and day when to check for new updates. In this case every day at 5:00 am
$schedule = [pscustomobject] @{day="EVERYDAY";hour=5;minute=0}
$updateSpec.check_schedule = @($schedule)
## Set new update policy
(Get-CisService -Name "com.vmware.appliance.update.policy").set($updateSpec)

## Disconnect from VCSA
Disconnect-CisServer vcenter.txusa.cloud -Confirm:$false

IBM SAN Solution Design Best Practices for VMware vSphere ESXi

My Redbook got published!



No, not that redbook!


My IBM SAN Solution Design Best Practices for VMware vSphere ESXi Redbook got published. You can download it for free, the same as all IBM Redbooks. You can also buy it for instance from amazon. I don’t know why you would but you could.

I did not write it all by myself, I had company writing in it. My co-authors were:

  • Richard Kelley
  • Scheila Rossana Rinaldo Maliska
  • Leandro Torolho
  • Jon Tate

The title of the Redbook speaks for itself. It has a focus on IBM b-type (Brocade) SAN switches and SVC, Storwize V7000 and Storwize V3700 Storage Systems. I would say most of it also applies to units from other vendors as well.

If you enjoy my Redbook then please take the time to rate it.

Nutanix explained by Josh Odgers

My Australian buddy Josh Odgers – VCDX 90# explains Nuntanix. He likes to rub in my face that he has a lower VCDX number than me but remember we defended the same week in Toronto.

Josh does a really great job explaining Nutanix, even I can understand. Great job!

Take the time and watch this little seven minute video if you are interested in storage and haven’t heard about Nutanix.

VMworld 2013 Session Videos

As I mentioned before this year I am not attending VMworld 2013. I am however still following what is going on. I was very excited to see that VMware has published a few sessions on youtube. I assume they will continue to do so as VMworld continues. For me it would have been great if they would have published it as apple podcasts since it would have allowed me to download it and watch it on the go. Still youtube is much better from what they have done in the past where you needed a pass to get access. As I remember there were even special passes just for online access. I am not sure if they have done the same thing last year as I was attending VMworld I wasn’t paying much attention to it. VMworld is growing and growing. Supposedly there are 22500 attendees this year which allegedly makes it the largest IT conference in the world. Moscone Center might hit its limit at some point so maybe in the future we will see that it gets booked out so it is even more valuable that the sessions will come publicly available right after. Thanks VMware!

Well here are the links. I don’t find it very organized but that might be due to youtube itself. The sessions are not necessarily under 2013 Sessions. I just go to videos at the moment. If you have the session numbers you can probable search for those.



Here are some direct links

VMworld 2013: Session VSVC4944 – PowerCLI Best Practices: A Deep Dive

VMworld2013: Session PHC5605-S – Everything You Want to Know About vCloud Hybrid Service

VMworld 2013: Session BCO5129 – Protection for All: vSphere Replication & SRM Technical Update

VMworld 2013: Session NET5847- NSX: Introducing the World to VMware NSX

VMworld 2013: Session SEC5893 – Changing the Economics of Firewall Services

VMworld 2013: Session VCM7369-S – Uncovering the Hidden Truth in Log Data

What will bring vCO 5.5?

Well this year I did not have the chance to go to VMworld SF, or lets say can’t afford to go every year. So the things I found are from the Web and not from VMworld and don’t have to be true. I will list a few things I found very shortly and I will comment them.

Simplified configuration
vCO 5.5 should by default use SSO and an embedded database, so as I understand you should be able to power it up and be ready to go. Of course in a production environment you should use an external database so my guess, for a production environment you still need to do some tuning.

High Availability
Supposedly you should be able to install vCO 5.5 in cluster mode. Active-Active or Active-Passive. An external database is needed for this. Well where I use it, there isn’t really a need for HA but I can picture that there are shops that need this.

Resume failed workflows
If a workflow failed you should be able to pick up the workflow and resume it. You can change the parameters before doing so. I cannot really picture this yet but sounds interesting.

New UI
It seems there were some complains about the new UI. I actually didn’t mind. I found the “for each” loop a little difficult to use but in general I thought it was an improvement over the old one. Seems they have changed it again and I am interested to see the changes.

Forward/Backward navigation through API browser.
This I find really exciting. Now you should be able to go back and forward in the API Browser. Before I clicked my self through the API and then needed to go back but couldn’t. You would need to search for your object again and start over from there. I have asked for this improvement last year when I was at VMworld and it seems I was not the only one. Very helpful, saves a lot of time. Actually I have also asked for the possibility to copy and paste from the API browser to the scripting pane. We’ll see if this will be possible as well. Really great news in my eyes.

That’s all for now on vCO 5.5 from my side. Waiting to get my hands on it in my new personal test lab once it is out.

vCO – Configure vMotion with Virtual Distributed Virtual Switch

Here is some code how to configure the vMotion address with a distributed virtual switch. Input parameter are my host and dvSwitch. I go through all portgroups and compare if it is called vmotion. If so I set IP and subnet. Hard coded so it is easier to understand, you probably want this also as input parameter or use some algorithm. For instance user last octet from MGT IP to have same last octet.

//myhost is input parameter of type VcHostSystem
//dvSwitch is input parameter of type...
var networkSystem = myhost.configManager.networkSystem;
var vMotionSystem = myhost.configManager.vmotionSystem;
var pgs = dvSwitch.portgroup;

for each (var pg in pgs)
	if (pg.name.toLowerCase() == "vmotion")
		System.log("vMotion PG name: " + pg.name);
		var nic = new VcHostVirtualNicSpec();
		nic.ip = new VcHostIpConfig();
		nic.ip.dhcp = false;
		nic.ip.ipAddress = ""; 
		nic.ip.subnetMask = "";
		nic.distributedVirtualPort = new VcDistributedVirtualSwitchPortConnection();
		nic.distributedVirtualPort.switchUuid = dvSwitch.uuid;
		nic.distributedVirtualPort.portgroupKey = pg.key;

		networkSystem.addVirtualNic("", nic);  // HostNetworkSystem
		vMotionSystem.selectVnic("vmk1");  //enable vMotion

vCO – Configure ESXi Syslog Server and more

In this example I configure some advanced setting on an ESXi host. Syslog server is just one of the.
First I create a for loop to create my hostSetting array objects. Then late I fill them. Always the key and a value. You can check the ESXi host advanced setting in GUI for parameters. You need to watch the type. For instance the port for the syslog server is of type value_IntValue. There are also float and long. I have to say I don’t know why it say deprecated for value. Maybe I have to come back on that.


//myhost is input parameter of type VcHostSystem
var hostSetting = new Array();

for (i=0; i<=3; i++)
	hostSetting[i] = new VcOptionValue();
hostSetting[0].key = "Syslog.Remote.Hostname";
hostSetting[0].value = "mysyslog.bigbluemike.com";

hostSetting[1].key = "Syslog.Remote.Port";
hostSetting[1].value_IntValue = 514;

hostSetting[2].key = "Config.Defaults.security.host.ruissl";
hostSetting[2].value = true;

hostSetting[3].key = "Annotations.WelcomeMessage";
hostSetting[3].value = "Welcome to this nice an shiny ESXi host.";


vCO – Configure NTP on ESX

In this example I set the NTP Server and then check if the NTP Service is running. If not I start it.

//myhost is input parameter of type VcHostSystem
//ntpServer is input parameter of type String[] (string array)

var hostDateTimeConfig = new VcHostDateTimeConfig();
hostDateTimeConfig.ntpConfig = new VcHostNtpConfig();
hostDateTimeConfig.ntpConfig.server = ntpServer;

//Set the ntp servers

//Check if the service is already running
var hostServiceInfo = myhost.configManager.serviceSystem.serviceInfo;
for each (var hostService in hostServiceInfo.service)
if (hostService.label == “NTP Daemon”)
//if the service is not running start it
if (hostService.running == false)
System.log(“Starting service ” + hostService.label + ” now”);
var ntpID = myhost.configManager.dateTimeSystem.id;
System.log(“Service ” + hostService.label + ” is already running”);

vCO – Remove default portgroup

This is another simple one. In my eyes useful if you want to use vCO to configure your ESX.
I go through all port groups on the host and compare if one is name “VM Network” if this is so then I remove it.

//myhost is input parameter of type VcHostSystem

var netSystem = myhost.configManager.networkSystem;
var pgs = myhost.configManager.networkSystem.networkConfig.portgroup
for each (var pg in pgs)
	if (pg.spec.name == "VM Network")