I’m executing a couple Windows scripting commands in the Run Once section of guest customization for a WIN2K8 VM, but it appears vSphere is not parsing it correctly, because there’s no sign of the commands having executed properly. However, it executes perfectly fine at the Windows command prompt. For reference, I've included the script below, albeit with IPs and variables modified.
set "C_ALIAS=netsh interface ipv4 set" && for /f "delims=" %a in ('netsh interface ipv4 dump ^| find "1.1.1.1"') do @set NIC_C=%a && call %C_ALIAS% %NIC_C:~4% metric=200
set "M_ALIAS=netsh interface ipv4 set" && for /f "delims=" %a in ('netsh interface ipv4 dump ^| find "2.2.2.1"') do @set NIC_M=%a && call %M_ALIAS% %NIC_M:~4% metric=500
One hunch I had was that the quotation marks included in the actual command were problematic, because vSphere encloses the entire command in quotation marks. Is this a valid assumption, and if so, does some sort of interrupt character need to be added for it to be parsed correctly?
If not, does anyone have any hunches as to why the above script is not executing properly? I would appreciate any assistance.