i am using below command to change the windows7 desktop OS to domain, but it is not working.
$Domainchange = "Add-Computer -DomainName $domain -Credential $userid"
Invoke-VMScript -VM $vm -ScriptText $Domainchange -GuestUser gusername -GuestPassword gpwd -ScriptType Powershell
Is UAC enabled in that guest OS?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes, i have enabled UAC,
rest of my commands are working, like renaming and changing IP
Could be, but this one requires UAC permission.
You can check by disabling UAC, and then testing your command again.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference