简体   繁体   中英

Issue while joining vm to a domain using invoke-vmscript

I am trying to join a vm to a domain. Here is the script:

Invoke-VMScript -vm $hostName -GuestUser $VMLocalUser -GuestPassword $VMLocalPWord -ScriptType Powershell "Add-Computer -ComputerName $hostName -LocalCredential $VMLocalCredential -DomainName $domainName -Credential $VMLocalCredential -Restart -Force"

While executing the script freezes at 0% completion. Please let me know if am doing something wrong.

Running that add-computer command on the machine, I had trouble getting the ComputerName command to recognise which lead me to this

Issue Adding PC to domain and changing name at the same time

Alternatively use netdom.

Invoke-VMScript -VM $vmname -GuestUser $VMLocalUser -GuestPassword $VMLocalPWord -ScriptType Powershell "netdom join /d:mywork.domain computername /userd:domainaccount /passwordd:pwd"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM