[Dutch] Inschrijvingen voor de tweede Nederlandse Nutanix User Group meeting zijn geopend

Op 28 november zal in Hoofddorp in de tweede Nederlandse Nutanix User Group meeting gehouden worden. In het mooie nieuwe kantoor van Nutanix hebben we een mooi programma samen kunnen stellen.

Schrijf je hier in: https://events.nutanix.com/event/?id=1571327994-5da88ffab8960-5db058b9652ac

  • 14:00 –14:30 Registration & Welcome
  • 14:30 –15:00 Keynote: Ruben Spruijt
  • 15:00 –15:45 Community Speaker: Vishwapreet Mahabir (PQR) – Xi Leap & Xi Frame with demo’s
  • 15:45 –16:00 Break & Refreshments
  • 16:00 –16:45 Community Speaker: Bart Donders (ICT Partners) – Data Management in the real world
  • 16:45 –17:30 Nutanix Support: Martin Miedema and Mustafa Gulkara
  • 17:30 –18:30 Networking & Dinner
  • 18:30 –19:15 Interactive Session: Favorite Tooling, Wouter Kursten
  • 19:15 – 19:30 PM Take-aways & Closing

Hopelijk zie ik je 28 november in Hoofddorp!

My schedule for VMworld 2019 Barcelona

In less than two weeks VMworld Europe will begin, for me it will be a busy one this year. With four sessions that I will participate in, a bunch of Design Studio sessions, parties and let’s not forget vSoccer (or football for us Europeans). Let me give you an insight into how my schedule will probably look. Probably because things can still change even during the event itself. Sadly there is no Hackathon this year but it would have been a hard choice between that and playing some football anyway.

Monday

My earliest session during the week will actually be on Monday starting at 8am with a Design Studio session. Later in the morning there will be another Design Studio session followed by the entire afternoon filled with an NSX-T workshop. While I am still undecided about the Partner reception I will go to the vSoccer in the evening. After last year’s first but very successful version of it in Las Vegas I am again looking forward to playing some footie with friends. Having lost a bit of weight the last year will also help in how long I will actually stay on the pitch.

Tuesday

This is a packed day for me, after the keynote where we bloggers can sit in the press area I will spend the entire day in the Community area and maybe the Solutions Exchange. I will be there because I will be in the vExpert Daily, will be presenting my own vBrownbag session and someone has to be there as emotional support for my buddy Hans’s first ever vBrownbag as well. From 17.30 I will be at Brian Madden’s EUC Community Tech Talks & Beer evening where I am presenting with previously mentioned Hans. Party wise I can go to the vExpert party but that’s a bit further away than I would like so I’ll wait on where the Benelux party is or I might even just go to the Veaam party.

Wednesday

The Wednesday is a mixed day for me starting in the community area to watch the vExpert Daily followed by two Design Studio sessions and two regular sessions. Well regular? One of the two is the live Virtually Speaking podcast with a lot of great names.

Thursday

On Thursday I will be presenting my own Horizon API 101 Session at the VMware{Code} stage. This session is fully booked but there’s probably a spot for everyone. Session wise I will be doing three regular sessions and a workshop. I will be flying back on Friday so if anyone wants to go out for dinner or something just let me know!

Nutanix .Next 2019 Copenhagen Day 2

And Nutanix .Next 2019 is already over. Today I enjoyed the first Keynote again from the Executive lounge and hit the community booth afterwards. I don’t think there was a lot of really new tech in the keynote but I liked seeing it anyway. The interview with Caroline Wozniacki was great she sound like a very humble and down to earth person to me.

In the community area we had way too much fun distributing the 100’s of Nutanix Design Guides that where shipped to Copenhagen. So much fun that I actually forget to go to the sessions where I wanted to go but hey I met some nice people and really felt like Operah with giving away those books.

The closing keynote had two parts, the first with Dr. Katie Boumann who worked on creating the image of the black hole the last few year. I barely understood 20% of what she was saying but I loved hearing about the process. The second part was with Kit Harrington from Game of Thrones, while I never really liked the show I loved hearing all of his stories.

And see you next year in Paris!

Nutanix .Next 2019 Copenhagen Day 1

Having arrived in Copenhagen on Sunday I have had plenty of time to go for some sightseeing but yesterday things really started for me at the Nutanix .Next event in Copenhagen. I haven’t done any sessions to be honest but had a full schedule anyway. First we started of at the keynote with the NTC’s getting a shoutout from marketing Chief Ben Gibson and one of us on just before at the celebration of 10 years of Nutanix: Andrea Mauro. Several announcements where made during the keynote like Metro availability for AHV, one minute RPO for Xi Leap and ESXi availability for Xi Leap as well. For me the highlight was Julie O’Brien (VP of marketing ) doing a tech demo on stage.

What followed after the keynote was a lot of networking and offcourse the yearly NTC lunch. While it was only a small group it actually was great to catch up with everyone. Too bad Angelo didn’t have a microphone because he was singing with the music as usual.

In the afternoon I did a roundtable session about a new type of certification that Nutanix is exploring. This was with a small group of ntc’s and I have to say the discussions where great and what is actually the future of us engineers and what does an engineer actually do?

For the evening keynote Angelo got us in the executive lounge (that hadn’t been used a lot during the day according to some of the staff). Too bad the part with Dimitri Vegas and Like Mike wasn’t broadcasted but they made up for that at the awesome party in the evening. They did a great set with lots of oldskool music that got the croud really going.

(yes my smartphone can’t handle 120+db’s of music)

 

The VMware Labs flings monthly for September 2019

And yet another month gone, next week I will be in Kopenhagen for Nutanix .Next and the month after that I will be speaking at VMworld Barcelona. Will I see you at either of these two events? Last month one new fling was released:  Kubernetes eXtensible Desktop Client (KXDC) , seven received updates: App Volumes Entitlement Sync, vSphere HTML5 Web Client, DoD Security Technical Implementation Guide(STIG) ESXi VIB, VMware OS Optimization Tool, vSphere Mobile Client, Workspace One UEM Workload Migration Tool, USB Network Native Driver for ESXi and one was marked deprecated: VIB Author.

New releases

Kubernetes eXtensible Desktop Client (KXDC)

The Kubernetes eXtensible Desktop Client (KXDC) is a simple and multi-platform desktop client for Kubernetes (K8S). In the same way the kubectl command requires only a valid kubeconfig file to run commands against a K8S cluster, KXDC requires you just to configure one or more valid kubeconfig files to interact with one or more K8S clusters.

Main features:

  • Support for multiple kubeconfig files.
  • UI-driven interaction with the most frequently used K8S entities.
  • One-click terminal with the proper KUBECONFIG env variable set.
  • Generation of custom kubeconfig files for a given namespace.
  • Highlight sustainability and security-related data.

Updated flings

App Volumes Entitlement Sync

The App Volumes Entitlement Sync fling will read, sync and compare entitlements between various App Volumes instances.

Changelog

Version 2.2

  • Ignore Extra AppStacks on Primary or Secondary Server – these would cause compare to crash
  • Export Primary or Secondary Server Entitlements to XML

vSphere HTML5 Web Client

Do you want to have the latest version of the html5 client? Than you need the vSphere HTML5 Web Client fling!

Changelog

Fling 4.3.0 – Build 14483008
New Features

  • Ability to customize the header color per vCenter to differentiate vCenter servers. Go to Administration -> System Configuration and select the vCenter for which you want to change the header color. If you have more than one vCenter server in linked mode, you can change the color for each of the vCenter servers

Bug fixes

  • Upload OVF files to Content Library

Release Notes

  • vSphere Perspective Management has been removed

DoD Security Technical Implementation Guide(STIG) ESXi VIB

The DoD Security Technical Implementation Guide(STIG) ESXi VIB fling helps in hardening your vSphere environment.

Changelog

Update September 2019

  • New ESXi 6.7 STIG VIB release
  • Updated sshd_config file. Removed protocol 2 setting as it is deprecated. Added “FipsMode yes” setting. Updated Ciphers and MACs for newer version of OpenSSH
  • Removed /etc/issue and /etc/pam.d/passwd files from VIB as those settings can be set via advanced settings now
  • Note – This VIB is based on draft STIG content! It is recommended to use this over the previous 6.5-7 STIG VIB

VMware OS Optimization Tool

The VMware OS Optimization Tool or OSOT in short is one of the best tools around to optimize your VDI image before publishing a desktop or rds host.

Changelog

September, 2019, b1110

  • New Common Options button – Allows you to quickly choose and set preferences to control common functionality. These would normally involve configuring multiple individual settings but can now be done with a single selection through this new interface
  • Split Windows 10 into two templates to better handle the differences between the versions; one for 1507-1803 and one for 1809-1909
  • Improved and new optimizations for Windows 10, especially for 1809 to 1909.

Updated and changed template settings for newer Windows 10 versions to cope with changes in the OS, registry keys and functionality:

  • Move items from mandatory user and current user to default user
  • Add 34 new items for group policies related to OneDrive, Microsoft Edge, privacy, Windows Update, Notification, Diagnostics
  • Add 6 items in group of Disable Services
  • Add 1 item in group of Disable Scheduled Tasks
  • Add 1 item in group of Apply HKEY_USERS\temp Settings to Registry
  • Add 2 items in group of Apply HKLM Settings
  • Removing Windows built-in apps is now simplified. Removes all built-in apps except the Windows Store.

Numerous bug and error fixes:

  • Reset view after saving customized template
  • Unavailable links in reference tab
  • Windows Store is unavailable after optimizing
  • Start menu may delay after optimizing
  • VMware Tools stops running after optimizing
  • Analysis Summary Graph is cropped

vSphere Mobile Client

Personally I think a phone screen is too small but this was one of the most asked questions the last few years: when can we manage vSphere from our phones? Well now you can with the vSphere Mobile Client fling.

Changelog

Version 1.5.0

New features

  • Direct connections to the ESXi hosts are now supported
  • Host can now be put in maintenance mode

Improvements

  • Going back from the details pages would not refresh the VM list
  • Improvements to how we indicate the user is in focused mode
  • Cluster card now shows issues, DRS, HA and number of vMotion events
  • Host card now shows issues, number of VMs, uptime and connection status

Bug Fixes

  • Removing a bookmark when in focused mode removes the item from the list too

Workspace One UEM Workload Migration Tool

With the Workspace One UEM Workload Migration Tool it’s easy to move devies and applications between WS One UEM environments.

Changelog

Version 2.0.0

  • Baseline Migration Support
  • MacOS application
  • UI refactoring to make bulk migrations easier
  • Added support for script detection with Win32 applications

USB Network Native Driver for ESXi

For the USB Network Native Driver for ESXi fling we need to thank WIlliam Lam I guess. For me it at least seems like he is the driving factor behind this fling.

Changelog

September 27, 2019 – v1.2

  • Added support for Aquantia Multi-Gig (1G/2.5G/5G) USB network adapter (see Requirements page for more details)
  • Added support for Auto Speed/Connection detection for RTL8153/RTL8152 chipsets

ESXi670-VMKUSB-NIC-FLING-28903484-offline_bundle-14722970.zip
ESXi650-VMKUSB-NIC-FLING-28903792-offline_bundle-14722993.zip

New Horizon API explorer posted (new queries!)

While watching the VMworld US 2019 video of Sean Massey presenting about getting started with the Horizon API’s I decided to check if the API explorer has been updated. To my surprise it was and it is good to see that several queries have been added besides the method’s that I previously found.

The new queries that I found are:

  • DesktopAssignmentView
    • Description:
      • Desktop id + Desktop assignment data which will include desktop pool information, operation system, global entitlement.
  • DesktopHealthInfo
    • Description:
      • Desktop health Information. This data will be populated only for the desktops which support application remoting.
  • GlobalEntitlementSummaryView
    • Description:
      • Summary information about Global Entitlements.
  • MachineSummaryView
    • Description:
      • This View includes summary data of all entities related to this Machine

So the DesktopAssignmentView seems to give a lot of similar data to what the DesktopSummaryData query already gives. They both give global entitlement data plus user assignment data. The big difference is that it gives way more detailed information about the desktop pool itself like vGPU settings. The names should have been DesktopInfo in my opinion.

Desktophealthinfo is created for the new Windows 10 App remoting and the monitoring for that. The globalentitlementsummaryview and machinesummaryview are linked to GlobalEntitlementInfo and MachineDetailsView from which they give a subset of data.

I hope to have a new blog post soon with more detailed information of what the new method’s and queries will bring but I wanted to update you with the fact that the api explorer has been updated as soon as possible.

Looking forward to Nutanix .Next in Copenhagen

This year will mark my third visit to the European Nutanix .Next conf, this time in lovely Copenhagen. This year though will be my first time as the Nutanix User Group Champion for The Netherlands. While the sessions will be awesome I am mostly looking forward to meeting the international #vCommunity once again.

My trip will start Sunday evening since the airfield closes to home only flies to Copenhagen on Sunday evening or Monday morning at cr*p o clock. This means I have spare time on onday and Tuesday that I will spend sightseeing if the weather permits. Hopefully I can get some people together to do a guided bicycle ride through town.

If you want to meet up during the event than hit me p on Twitter or look at the community area, there’s a good chance of seeing me there. I will be trying to visit a variety of sessions from architectural deep dives to new technology like Nutanix Mine with a side meal of IoT and the Edge. And I am certainly looking forward to the closing keynote because it sounds like it will be awesome. Maybe not as awesome as the keynote with Dr. Jane Goodall but that one is hard to top anyway.

So will I see you at .Next for some coffee and stroopwafels?

 

 

The VMware Labs flings monthly for August 2019

It’s been a bit quiet on the fling front with VMworld US happening. None the less there have been two new releases and three updates. New releases are the vSAN Performance monitor and Enterprise OpenShift as a Service on Cloud Automation Services flings. Updated where the vSphere Mobile Client, vRealize Operations REST Notifications Helper and Virtual Machine Compute Optimizer.

New Releases

vSAN Performance Monitor

The vSAN performance monitor is a monitoring and visualization tool based on vSAN Performance metrics. It will collect vSAN Performance and other metrics periodically from the clusters configured. The data collected is visualized in a more efficient and user-friendly way. The vSAN performance monitor comes with preconfigured dashboards which will help customers evaluate the performance of vSAN clusters, identify and diagnose problems, and understand current and future bottlenecks. The dashboards are heavily inspired by vSAN Observer.

The vSAN performance monitor is delivered in a virtual appliance with three major components, i.e., a Telegraf collector, InfluxDB, and a Grafana frontend.

  • Telegraf: Telegraf is the agent that collects metrics from vSAN cluster and stores them in InfluxDB.
  • InfluxDB: InfluxDB is the database to store the metrics
  • Grafana: We use Grafana as the frontend to virtualize the metrics stored in the InfluxDB

Once deployed, users will need to do some simple configuration changes to point the collector to target vSAN cluster(s) and start the service. After that, the data will be collected periodically and can be visualized for meaningful insights.

Enterprise OpenShift as a Service on Cloud Automation Services

This Fling enables a cloud admin to download the package, integrate with Cloud Assembly and other Infrastructure services and be able to provide an “OpenShift Cluster as a Service” offering. This Fling automates the end to end deployment process. End users can simply request for and get an enterprise grade distributed instance of OpenShift Cluster. This Fling provides all the required packages to configure and deploy an enterprise production grade OpenShift cluster using VMware Cloud Assembly Services with minimal effort and in a repeatable, fully automated fashion.

Updated Flings

vSphere Mobile Client

The vSphere Mobile Client is under heavy development to make sure we have the best experience in managing our vSphere environments using our mobile phones.

Changelog

Version 1.4.0

New features

  • Cluster view

Improvements

  • Confirmation dialog on VM quick actions

New Bug Fixes

  • Task card layout improvements
  • Alarms and events truncation issue has been fixed
  • iOS crash report improvementsVersion 1.3.0

New features:

  • Hosts view
  • vCenter dashboard now includes items with most alerts

Improvements

  • Crash reporting for iOS
  • Event categories are now visible (alarm, error, warning)

Bug Fixes

  • Better handling of vCenter name retrieval

vRealize Operations REST Notifications Helper

The vRealize Operations REST Notifications Helper helps in creating better REST notifications of alerts.

Changelog

Version 1.2.1

  • Updated instructions for v1.2
  • Minor fixes and improvements

Version 1.2.0

  • Multiple endpoint configurations
  • Blacklist
  • Windows support
  • Minor new features, improvements and fixes

Virtual Machine Compute Optimizer

The Virtual Machine Compute Optimizer (VMCO) is a Powershell script that uses the PowerCLI module to capture information about the hosts and VMS running in your vSphere environment, and reports back on whether the VMs are configured optimally based on the Host CPU and memory.

Changelog

Version 1.0.4

  • Added a -Property filter to the Get-View commands for hosts and VMs to reduce time and amount of returned data
  • Removed if statement in Get_Optimal_CPU function that included $hostCPUs as it was not yet being used

 

Updates to the Horizon API’s in PowerCLI 11.4

So today PowerCLI 11.4 was released with the following updates:

  • Add support for Horizon View 7.9
  • Added new cmdlets to the Storage module
  • Updated Storage module cmdlets
  • Updated HCX module cmdlets

As usual we need to wait for API explorer to be updated before we get the exact changes to the api’s but I already grabbed s short list by comparing the methods. Later I will create a more elaborate blog post about the changes if I have an overview. What I do see are some new additions that might be added to the vCheck for Horizon.

Also: even though the updates are for Horizon 7.9 there’s a good chance that a lot of this also works for previous versions, the examples below where done with 7.8.

  • Datacenter
  • DesktopHealth
  • Gateway
  • GatewayHealth
  • MessageClient
  • Monitoring
  • PersistentDiskQueryService
  • Privilege
  • SecondaryCredentials
  • SessionStatistics
  • StorageAccelerator
  • UsageStatistics
  • Validator
  • VirtualCenterStatistics

Sadly it’s late so I can only show a couple of examples:

$services.Privilege.Privilege_ListSelectablePrivileges()

 

$services.SessionStatistics.SessionStatistics_GetLocalSessionStatistics()

Finally we can reset the usage counters as well now

And some statistics from vCenter

($services.VirtualCenterStatistics.VirtualCenterStatistics_listSummaryStatistics())
($services.VirtualCenterStatistics.VirtualCenterStatistics_listSummaryStatistics()).DataStoreSummaryStatistics

Generating a clean Host Profile using PowerCLI

First of all: I love Host Profiles! But they’re easy to mess up as well, leave something selected related to hardware and an update in ESXi, vib’s or even a firmware update might break it. For a customer where we are going to do the entire vSphere build from scratch I got the idea to generate an empty Host Profile and extend that one using scripting. At first I though this would be an easy thing but it definitely isn’t, a reply from PowerCLI guru Luc Dekens at the VMware{Code} forums set me on the right path to do so. Luc’s remark that editing Host Profiles might take some reverse engineering for the lack of documentation is a huge understatement. It has cost me many many hours to build the script below.

I strongly recommend having the reference host as clean as possible.

These are the steps the script takes

  1. connect to vCenter
  2. extract a new Host Profile
  3. Gets the new Host Profile
  4. Copies all members of the new Host Profile to an object that can be edited
  5. Sets everything that I could find in my environment to false
  6. Updates the Host Profile with the edited object

Required parameters

  • vCenter
    • Your vCenter host
  • Referencehost
    • the name of the host in vCenter
  • Hostprofilename
    • Name for the Host Profile

There are also a couple of optional parameters:

  • dnshost
    • It’s mandatory to have a DNS set in the defaulttcpipstack. With this parameter you can change this.
  • domainname
    • Like DNS it’s mandatory to have a domainname set in the defaulttcpipstack. With this parameter you can change this
  • Cleanup
    • This one defaults to false but can be set to true. It will remove all NFS Datastores, vmkernel ports, portgroups, device aliases and direct i/o profiles.
    • Use this one with care, if you apply it to a host it will most probably remove all networking details for that host making it unusable.

This is how a manual extracted Host Profile looks

This is how a Host Profile looks after using my script without the cleanup option, everything is deselected but the device aliases for example are kept.

.\create_clean_hostprofile.ps1 -vcenter vCenter -Hostprofilename demo_no_cleanup -referencehost hostname

And this is how it looks with the cleanup used.

.\create_clean_hostprofile.ps1 -vcenter vCenter -Hostprofilename demo_no_cleanup -referencehost hostname -cleanup $true

The script itself can be found on Github as well:

#-------------------------------------------------
# Generates a clean Host Profile
#
# Build using PowerCLI 11
#
# Version 1.0
# 17-08-2019
# Created by: Wouter Kursten
# Website: https://www.retouw.nl
#
#-------------------------------------------------

param(
[Parameter(Mandatory=$true)][String]$Hostprofilename,
[Parameter(Mandatory=$true)][String]$vcenter,
[Parameter(Mandatory=$true)][String]$referencehost,
[Parameter()][String]$dnshost,
[Parameter()][String]$domainname,
[Parameter()][bool]$Cleanup = $false
)

# I grabbed this function somewhere from an example by Luc Dekens
function Copy-Property ($From, $To, $PropertyName ="*"){
    foreach ($p in Get-Member -In $From -MemberType Property -Name $propertyName){
        trap {
            Add-Member -In $To -MemberType NoteProperty -Name $p.Name -Value $From.$($p.Name) -Force
            continue
        }
    $To.$($P.Name) = $From.$($P.Name)
    }
}

#connect to the vCenter
connect-viserver $vcenter

# This deletes any existing Host Profile with the same name as we're using in this script
get-vmhostprofile -name $Hostprofilename  -ErrorAction SilentlyContinue | Remove-VMHostProfile -Confirm:$false

# This creates a new Host Profile from the referencehost
new-vmhostprofile -name $Hostprofilename -referencehost $referencehost

# Retrieves the newly created Host Profile
$hp = Get-VMHostProfile -Name $Hostprofilename

# Creates the spec where the cleanup is done
$spec = New-Object VMware.Vim.HostProfileCompleteConfigSpec

# Copies all properties of the new Host Profile to the spec
Copy-Property -From $hp.ExtensionData.Config -To $spec

# This removes everything that could be specific to the referencehost
if ($cleanup -eq $true){
    $spec.ApplyProfile.Network.Vswitch=$null
    $spec.ApplyProfile.Network.VMportgroup=$null
    $spec.ApplyProfile.Network.HostPortGroup=$null
    $spec.ApplyProfile.Network.pnic=$null
    $spec.ApplyProfile.Storage.NasStorage=$null
    ($spec.ApplyProfile.Property | where-object {$_.PropertyName -like "*DeviceAlias*"}).profile=$null
    ($spec.ApplyProfile.Property | where-object {$_.PropertyName -like "*PCI*"}).profile.property.profile=$null
}

# From here it's just disabling of items except for:
# -items under storage> PSA Configuration (profiles are removed)
# -Properties of the fixed DNS config (set to the default values from this scripts parameters)
$spec.ApplyProfile.Datetime.Enabled=$False
$spec.ApplyProfile.Authentication.Enabled=$False
$spec.ApplyProfile.Authentication.ActiveDirectory.Enabled=$False

foreach ($o in $spec.applyprofile.Option){
    if ($o.Enabled){
        $o.Enabled=$False
    }
}

foreach ($p in $spec.ApplyProfile.Property.Profile){
    if ($p.Enabled){
        $p.Enabled=$False
    }
    foreach ($pa in $p.Property.Profile){
            if ($pa.Enabled){
                $pa.Enabled=$False
                }
        foreach ($paa in $pa.Property.Profile){
                if ($paa.Enabled){
                    $paa.Enabled=$False
                }
        }
    }
}

foreach ($s in $spec.ApplyProfile.Storage.Nasstorage){
    if ($s.Enabled){
        $s.Enabled=$False
    }
    foreach ($sa in $s){
        if ($sa.Enabled){
            $sa.Enabled=$False
        }
    }
}

foreach ($s in $spec.ApplyProfile.Storage.Property.Profile){
    if ($s.Enabled){
        $s.Enabled=$False
    }

    if ($s.ProfileTypeName -eq "psa_psaProfile_PluggableStorageArchitectureProfile" -AND $cleanup -eq $true){
        foreach ($sa in $s.property){
            if ($sa.propertyname -like "*psa_psaProfile_PsaDevice*"){
                [email protected]()
            }
        }
    }
    foreach ($sa in $s.Property.Profile){
        if ($sa.Enabled){
            $sa.Enabled=$False
            }
        foreach ($saa in $sa.Property.Profile){
            if ($saa.Enabled){
                $saa.Enabled=$False
            }
        }
    }
}

foreach ($f in $spec.ApplyProfile.Firewall.ruleset){
    if ($f.Enabled){
        $f.Enabled=$False
    }
}

foreach ($n in $spec.ApplyProfile.Network.vswitch){
    if ($n.Enabled){
        $n.Enabled=$False
    }
    foreach ($na in $n){
        if ($na.Enabled){
            $na.Enabled=$False
        }
        foreach ($naa in $na.link){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.NumPorts){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.NetworkPolicy){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
    }
}

foreach ($n in $spec.ApplyProfile.Network.pnic){
    if ($n.Enabled){
        $n.Enabled=$False
    }
    foreach ($na in $n){
        if ($na.Enabled){
            $na.Enabled=$False
        }
    }
}

foreach ($n in $spec.ApplyProfile.Network.VmPortGroup){
    if ($n.Enabled){
        $n.Enabled=$False
    }
    foreach ($na in $n){
        if ($na.Enabled){
            $na.Enabled=$False
        }
        foreach ($naa in $na.Vlan){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.Vswitch){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.NetworkPolicy){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
    }
}

foreach ($n in $spec.ApplyProfile.Network.HostPortGroup){
    if ($n.Enabled){
        $n.Enabled=$False
    }
    foreach ($na in $n){
        if ($na.Enabled){
            $na.Enabled=$False
        }
        foreach ($naa in $na.IpConfig){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.Vlan){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.Vswitch){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
        foreach ($naa in $na.NetworkPolicy){
            if ($naa.enabled -eq $True){
                $naa.Enabled=$False
            }
        }
    }
}

foreach ($n in $spec.ApplyProfile.Network.Property.Profile){
    if ($n.Enabled){
        $n.Enabled=$False
    }
    foreach ($na in $n.Property.Profile){
        if ($na.Enabled){
            $na.Enabled=$False
            }
        foreach ($np in $na.policy.policyoption){
            if ($np.id -eq "FixedDnsConfig"){
                foreach ($npp in $np.parameter){
                    if ($dnshost){
                        if ($npp.key -eq "address") {
                            [string[]][email protected]($dnshost)
                            $npp.value=$dnsarray
                        }
                    }
                    if ($domainname){
                        if ($npp.key -eq "domainName"){
                            $npp.value=$domainname
                        }
                    }
                }
            }
        }
        foreach ($naa in $na.Property.Profile){
            if ($naa.Enabled){
                $naa.Enabled=$False
            }
            foreach ($naaa in $naa.Property.Profile){
                if ($naaa.Enabled){
                    $naaa.Enabled=$False
                }
            }
        }
    }
}


(Get-VMHostProfile $Hostprofilename).ExtensionData.Updatehostprofile($spec)
disconnect-viserver $vcenter -confirm:$False

And yes that’s a lot of foreach’s.