title: Command Get-ADUser -Filter doesn't work in PSSession
body: <p>I'm doing a script for changing user account AD with a GUI.
  When selecting a user in a list, I want to show all the groups of which he is a member.
  For the order it is OK but in a PSSession the command does not work, the <code>-Filter</code> parameter does not recognize the variable</p>
  
  <pre><code>$SessionAD = New-PSSession -ComputerName $AD
  Invoke-Command $SessionAD -Command {Import-Module ActiveDirectory}
  Import-PSSession $SessionAD -Module ActiveDirectory
  
  ...
  
  $var = $ListeUsers.SelectedItem
  $GroupsMember = Get-ADUser -Filter {Name -like $var} -Property MemberOf |
                  Select -ExpandProperty MemberOf |
                  Get-ADGroup -Property MemberOf |
                  Select Name
  </code></pre>
  
  <pre>
  Error : La variable : « var » trouvée dans l’expression : $var n’est pas définie.
      + CategoryInfo          : InvalidArgument : (:) [Get-ADUser], ArgumentException
      + FullyQualifiedErrorId : La variable : « var » trouvée dans l’expression : $var n’est pas définie.,Microsoft.ActiveDirectory.Management.Commands.GetADUser
      + PSComputerName        : AD-01
  </pre>
  
  <p>With the code below the command runs fine, but I can not retrieve the values of the variable <code>$GroupsMember</code>:</p>
  
  <pre><code>Invoke-Command -Session $SessionAD -ArgumentList $var,$GroupsMember -ScriptBlock {
      Param($var, $GroupsMember)
      $GroupsMember = Get-ADUser -Filter {Name -like $var} -Property MemberOf |
                      Select -ExpandProperty MemberOf |
                      Get-ADGroup -Property MemberOf |
                      Select Name
  }
  </code></pre>