You should understand the security implications of these changes before applying them. Note: Change these settings at your own risk. Those two things along with Stackflow suggestions is what brought me to the following solution: I noticed I could run the script from another VM in the same WORKGROUP when I disabled the firewall but still couldn't do it from a machine on the domain. Restart-Computer -ComputerName Måomputer -Authentication Default -Credential $cred -force I was running into the exact same error message when trying to execute the following script (partial) against a remote VM that was configured to be in the WORKGROUP. You can take a closer look using Write-Host: ForEach ($_ in gc u:\pub\list.txt) If the file looks right, then maybe the lines are not properly terminated. Probably there is a problem with the file contents. $_ doesn't contain a proper computer name. So in your case it seems when this line is executed: Get-WmiObject win32_SystemEnclosure -Computer $_ So the firewall suggestions are reasonable, but in this case probably not correct because you say this works: Get-WmiObject win32_SystemEnclosure -Computer hostname This is the result you get when a machine is not reachable. Get-WmiObject : The RPC server is unavailable. Your code probably isn't using a correct machine name, you should double check that.
0 Comments
Leave a Reply. |