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 Profile photo of Benjamin Sigrist Benjamin Sigrist 9 months, 2 weeks ago.

  • Author
    Posts
  • #35181
    Profile photo of Benjamin Sigrist
    Benjamin Sigrist
    Participant

    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

    Get-DfsReplicationGroup

    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
       eplicationGroupCommand

    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
    Profile photo of Ed Grant
    Ed Grant
    Participant

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

  • #35217
    Profile photo of Benjamin Sigrist
    Benjamin Sigrist
    Participant

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

  • #35292
    Profile photo of Nagendra Narembally
    Nagendra Narembally
    Participant

    Are you getting same error message by using below methods?

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

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

    Please check 80 port is open on your remote server.

  • #35561
    Profile photo of Benjamin Sigrist
    Benjamin Sigrist
    Participant

    Still no luck

You must be logged in to reply to this topic.