title: Get-ADuser filter with variable issue
body: <p>I have a script to get users information from the Active directory. It will first get the names of the users then store it in a variable before passing it through a foreach loop to get the details of each account. The script can be run but the CSV file is empty. The following is the script. Appreciate the help.</p>
  <pre><code>PROCESS{
  $path = &quot;C:\Users\Administrator\CSVReports&quot;
       
      $reportdate = Get-Date -Format ddmmyyyy 
   
      $csvreportfile = $path + &quot;\ALLADUsers_$reportdate.csv&quot; 
  
  $Admins = (Get-ADGroupMember -Identity Administrators | select-object Name)
  
  Foreach( $i in $Admins){
  $UserDetails= Get-ADUser -Filter &quot;Name -eq '$i'&quot; -Properties * | select-object DisplayName, samaccountName, Enabled, Created, LastLogonDate | sort-object -Property LastLogonDate
  }
  
  $UserDetails | Export-Csv -Path $csvreportfile -NoTypeInformation     
  }
  </code></pre>