'Workaround to "Add-Computer : Cannot establish the WMI connection to the computer 'computer' with the following error message: Access is denied."
I want first to thank all of you for the continuous help. Now once more I need your assistance. I receive the error :
Add-Computer : Cannot establish the WMI connection to the computer 'computer' with the following error message: Access is denied
whenever I try to run the below code.
$computers = Import-Csv "C:\2.txt" -Header Oldname,Newname
foreach ($name in $computers) {
Rename-Computer -ComputerName $name.OldName -newname $name.NewName -DomainCredential $cred -Force -PassThru -Restart
}
Later to be sure I run
Get-WmiObject -ComputerName "name" -Class win32_OperatingSystem which gives me the error
Get-WmiObject : The RPC server is unavailable.>
My question is if there is a workaround or a way to collectively enable WMI or RPC to all the pcs instead of doing it manually one at the time (which would be out of the question since we are talking for more than 500 pcs). Or if there is another way to rename the PCs and later join to workgroup that won't give me that error that I don't know.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
