PowerShell: Get-Process -ComputerName localhost, fails with 'Couldn't connect to remote machine'

This issue came up during my PowerShell class today and since I couldn’t find any information about it, I thought it was worth a quick post. There aren’t many practical reasons for running a cmdlet with the ComputerName parameter and localhost as the computer other than for demo or training purposes when you may not have a remote machine to test against.

Running the below may result in the error ‘Couldn’t connect to remote machine’


Get-Process -ComputerName localhost

However, running either of these alternatives is successful: the machine name or .


Get-Process -ComputerName WIN8

Get-Process -ComputerName .

To be able to run this with localhost the Remote Registry service needs to be running. Depending on your version of Windows and your corporate security policy this service may or may not be running and might be disabled.

Note: You should check the security implications of running the Remote Registry service in your environment before starting this service.

Once you have started the Remote Registry service, using localhost will then work.


Get-Process -ComputerName localhost