I am having a problem with this script and not recognizing the %computername%
foreach ($vm in $vms)
invoke-vmscript -vm $vm -guestuser administrator -guestpassword xxxxx -scripttype bat -scripttext
'net dom remove %computername% /userd:administrator /passwordd:yyyyyy /reboot /force' -verbose
any idea why it cannot recognize the %computername%