title: Powershell Export-CSV error
body: <p>Just wondered if you can help me please.  I receive the following error:</p>
  
  <pre><code>Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
  At C:\PSScripts\CompassADStaff.ps1:33 char:20
  + $Staff | Export-Csv &lt;&lt;&lt;&lt;  CompassADStaff.csv -NoTypeInformation
  + CategoryInfo          : InvalidData: (:) [Export-Csv], ParameterBindingValidationException
  + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCommand
  </code></pre>
  
  <p>My code seems OK but I can't seem to detect why export-csv generates the above error:</p>
  
  <pre><code>Import-Module ActiveDirectory
  
  #-------- Object variables ----------------------------------------------
  
  #OU's to search
  $searchbase = "ou=staff1,ou=users,dc=home,dc=local","ou=staff2,ou=users,dc=home,dc=local"
  
  $Staff = @()
  
  #------------------------------------------------------------------------
  
  
  foreach ($ou in $searchbase) {
  $Staff += get-aduser -LDAPFilter "(&amp;(objectCategory=person)(objectClass=user)(mail=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))" -SearchBase $ou -properties * | select-object employeeID,givenName,sn,sAMAccountName,mail
  }
  $Staff | Export-Csv CompassADStaff.csv -NoTypeInformation  
  </code></pre>
  
  <p>Any help or pointers would be great :)</p>
  
  <p>Thanks</p>