Creating multiple virtual switch port groups on ESXi hosts.
You only need to change variables according to yourself then you can easily run the script.
You need following software and versions to use scripts.
* PowerCLI 12.1.0 or above
* Windows PowerShell 5.1 or above
* VMware vCenter 6.5 or above (vSphere 8 not tested)
You can visit my blog for creating multiple port groups on ESXi hosts with PowerCLI and more detailed information.