can’t understand a strange behavior of -CompureName parameter on certain cmdlets
when i use this parameter on Invoke-Command or Get-Service it works, but if I use it on
cmdlets like Get-Process or Get-EventLog it give me errors, in order:
- ‘Couldn’t connect to the remote machine’
- ‘The network path was not found’
Even if i use -CumputerName localhost it give me errors
The only value this parameter accept on those cmdlets is the actual local computername
If i use “Get-Service -Computername” i can execute this commandlet with values like localhost or a remote computer name
and this work
Any tip how to solve this errors and get -ComputerName parameter works?
In particular: why this parameter works for example on Get-Service and it doesn’t on Get-Process or Get-EventLog?
thank you in advance
Get-Process, Get-EventLog and Get-Service name doesn’t uses PowerShell remoting (like Invoke-Command) to connect to a remote machine. they have their own mechanisms to connect to remote system.
For example, Get-Service uses ServiceController (string name, string machineName) to connect to remote system. similarly other two cmdlets. so here issue could be some policies or some other services which is required for those cmdlets are not up/set. Get-Process cmdlet is depended on RemoteRegistry service to connect to remote machine, so make sure that service is running on the remote node.
thanks a lot,
that was the issue, I had RemoteRegistry and RemoteAccess services stopped
i had to enable them via Control Panel cause Start-Service cmdlet gave me an error.
The RemoteAccess (Routing and Remote Access) service probably is needed for remote desktop connection,
but I enabled it anyway just in case.
Now both Get-EventLog and Get-Process work with -ComputerName parameter, whether i feed it a value of localhost or the remote computer name.
Again thanks for the help,
have a nice day