Whoever is working with LACP on switches and LAG on vSphere hosts must have noticed that the New-VDSwitch cmdlet doesn’t give you the option to create the LAG on your VDSwitch. There is also no new-Lag or set-LagOnVdswitch cmdlet. If you have a small environment it is not a big deal to use the WebClient for creating the LAG and migrate to it.
But when you have to build large environments with multiple switches or if you have to rebuild your environment multiple times for test purposes it is a burden it cannot be automated using PowerShell. That’s why I was happy to find (thanks to a colleague) the website of LagerHaus (https://www.lagerhaus128.ch/?p=982). This man has made a custom PowerShell module to create new switches with the option to create a LAG. It did almost the right job for me but I had to add the option to use the right load balancing method. As you might know, it is best to set it the same on the both (physical switch and distributed switch) sides. Note that the Load balancing setting on the LAG will override the load balancing method set in de PortGroups. This is what I created of the LagerHaus custom PowerShell module: