So I have a powershell script, Add-Computer -ComputerName $computername -LocalCredential $computername\admin -DomainName $domain -Credential domain\$username -Force -Restart
So if I have a machine that has either fallen off the domain or is disabled, and I run the following command, I get an error: Remove-Computer : Cannot establish the WMI connection to the computer '$computername' with the following error message: The
RPC server is unavailable. (Exception from HRESULT: 0x800706BA).
Now I have verified that the machine is in fact on the network and I am able to RDP to it. IS there something wrong or will this not work if the machine is not active in AD?
Figured it out, if I set-item wsman:\localhost\Client\TrustedHosts -value *
on my local machine to allow remote connections from untrusted sources since certificate errors don't pop up.
And then move it into a ScriptBlock
it runs.
Add-Computer will add the local computer to a domain : Link
You can try to add your machine using PowerShell Remoting
Assuming your machine is online make sure Remote Registry service is running and accessible, ie. disable firewall or create an exception.
User contributions licensed under CC BY-SA 3.0