Running commands with -computername parameter

Welcome Forums General PowerShell Q&A Running commands with -computername parameter

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
  • #6094

    Points: 0
    Rank: Member

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


    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
    Get-Process -computername pc_name

    In either way, I am getting the following error:

    Get-Process : Couldn't connect to remote machine.

    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 {

    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.

The topic ‘Running commands with -computername parameter’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort