Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 176561

Joining VMs to Domain using PowerCLI

$
0
0

Hey there,

 

I'm running the following script on a group of VMs within a vApp in an attempt to get them to join my domain:

 

$vms = Get-VM -Location vAppname
$vmUser = "Administrator"
$vmPass = "password"
foreach ($vm in $vms){     $cmd = "wmic.exe /interactive:off ComputerSystem Where ""Name='%computername%'"" call JoinDomainOrWorkgroup AccountOU=""OU-Computers`;DC=mydomain';DC=net"" FJoinOptions=1 NAme="mydomain.net"" Password=""password"" Username=""user@mydomain.net""
Invoke-VMScript -VM $vm -ScriptType bat -ScriptText $cmd -GuestUser $vmUser -GuestPassword $vmPAss
}

This script runs through the VMs and I get "Method execution successful" each time.  The problem is that the script doesn't appear to do anything.  Even after reboot, all of the machines are still using local accounts on WORKGROUP.

 

Any advice would be greatly appreciated!


Viewing all articles
Browse latest Browse all 176561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>