I've developing a PowerShell 3 script to automate the deployment of a XenApp Windows 2008 image to a Hyper-V 2013 host. The basic steps are this:
Add-Computer -ComputerName $VMIP -DomainName "medc.udcsms.com" -LocalCredential $LocalCredential -Credential $DomainCredential -Verbose -Restart
This fails with following error:
Add-Computer : Cannot establish the WMI connection to the computer '10.14.31.61' with the following error message: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).
The credentials are constructed using the following type of command:
$DomainCredential = New-Object System.Management.Automation.PsCredential "FQ-DomainName\it.support", $DomainPassword)
Run the same command again manually immediately and it fails. If one then waits for a significant time (say 30 mins maybe - don't know exactly) and run the command, it works.
First thoughts somehow were the firewall so I turned that off and recreated the image. No difference.
Another thought was that the original gold VM before if was sysprep'd was in the domain and had group policy applied to it. When the new VM boots and syspreps, it's not on the domain and I'm unsure what state that previous group policy which have on the server. Possibly a red herring.
It's almost as if the machine kind of isn't ready for RPC but that it sorts itself out after a time - but a long time in the scheme of things. I can understand services not been quite ready after boot but not 15+ minutes.
I guess what I'm looking for here is either and magic anwswer (!) or tips on debugging the RPC server and the mechanism Add-Computer uses to attempt to get the machine to join the domain.
User contributions licensed under CC BY-SA 3.0