Powershell command works in local PS prompt, but not in a remote PS prompt

This topic contains 4 replies, has 3 voices, and was last updated by  Benjamin Sigrist 2 years, 4 months ago.

  • Author
  • #35181

    Benjamin Sigrist

    I am just beginning to use PS Remoting to administer servers but have run into a snag. When I am at the local server command line, I can run a command like


    and the prompt returns back a list of my DFS Replication Groups. However, when I am in a remote PSSession to the same server, and run the same command, I receive an error

    Value cannot be null.
    Parameter name: args
        + CategoryInfo          : NotSpecified: (:) [Get-DfsReplicationGroup], ArgumentNullException
        + FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.DistributedFileSystemReplication.Commands.GetDfsR

    I have tried entering a remote session from not only Windows 10 but also from another Server 2012 R2 machine that has the same roles installed. I have also tried similar approaches using Import-Session, Invoke-Command and have also tried to Import-Module DFSR without success.

    It seems like somehow the command is operating differently depending on where it originates. The remote session appears to be working for other commands (I can change directories, create and delete files okay).

    I set up my remote PSSession by:

    $cred = Get-Credential
    Enter-PSSession Server1 -Credential $cred

    What am I missing in my remote-session setup?

  • #35214

    Ed Grant

    What version of PowerShell is running on the remote machine? A version difference might be causing an issue.

  • #35217

    Benjamin Sigrist

    Good call. I checked, but yes, they are running the same version.

  • #35292

    Nagendra Narembally

    Are you getting same error message by using below methods?

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http:///PowerShell/ -Authentication Kerberos
    Import-pssession $session

    Invoke-command -session $ses -scriptblock { Get-DfsReplicationGroup }
    Invoke-command -computername remote -scriptblock { Get-dfsreplicationgroup }

    Please check 80 port is open on your remote server.

  • #35561

    Benjamin Sigrist

    Still no luck

You must be logged in to reply to this topic.