Running commands with -computername parameter

by buuren at 2012-09-26 23:46:39

Hello,

I’ve a workgroup environment which consist of 10 workstations. Every workstation is in the same local network. I’ve run the following commands:
echo Y | winrm quickconfig
enable-psremoting -force
cd wsman:
cd localhost\client
Set-Item TrustedHosts * -force
stop-service winrm
start-service winrm


And now I’m able to connect to those workstations using the following commands:
New-PSSession 192.168.50.X
Enter-PSSession 1


However, when I try to execute default cmdlets (for example Get-Process) using a -computername parameter
Get-Process -computername 192.168.50.X
or
Get-Process -computername pc_name

In either way, I am getting the following error:
[quote]Get-Process : Couldn’t connect to remote machine.[/quote]

Basically every remote command fails to execute (OpenRemoteBaseKey("LocalMachine", $ComputerName) for example).

Am I missing something? I’ve read the book mentioned in the sticky, I could be wrong, but it appears I’m missing SSL certificates or those commands will only work in a domain environment. Not sure exactly what the problem is. Should I mention I’m fairly new into PowerShell remoting and PowerShell in general.

Thanks in advance!

EDIT: As a temporary workaround, I’m commands using Invoke-Command cmdlet:

Invoke-Command -ComputerName 192.168.50.X -ScriptBlock {
Get-Process
}


Which works very well and returns me running processes on 192.168.50.X workstation.
by DonJ at 2012-09-27 07:07:51
Get-Process doesn’t use Remoting. It uses RPCs, and depends on the Remote Registry service. The only commands that use Remoting are the ones which also have -UseSSL, -PSSessionOption, and similar parameters. If it’s just -ComputerName, it ain’t Remoting and has nothing to do with WS-MAN.