You can export your virtual machines including Operating System and Powerstate informations to specified folder path. After exporting the file you need to write new vSphere Tag names in to the .csv file than you can create these tags and assign your virtual machines.
If you never worked with vSphere Tags and if you are Veeam user than you can manage your Veeam operations with vSphere Tags. You can follow my article below to create and assign vSphere Tags to your virtual machines from scratch.
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
* Linux PowerShell 7 or above
* VMware vCenter 6.5 or above (vSphere 8 not tested)
You can visit my blog for creating vSphere Tags with PowerCLI and more detailed information.