Author Posts

February 11, 2016 at 12:44 pm

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?

February 12, 2016 at 9:01 am

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

February 12, 2016 at 9:20 am

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

February 16, 2016 at 1:54 am

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.