title: Method invocation failed because System.Object[]] does not contain a method name indexOf in PowerShell
body: <p>I have error IndexOf when i tried to run the following powershell script. Any advise</p>
  
  <pre><code>$unlicensedUsers = Get-MsolUser -UnlicensedUsersOnly
  foreach ($aUser in $unlicensedUsers)
  {
     if ($unlicensedUsers.IndexOf($aUser) % 10 -eq 0) {
              Write-Host -ForegroundColor yellow $unlicensedUsers.IndexOf($aUser)
     }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>IndexOf : Method invocation failed because System.Object[]] does not contain a method name indexOf</p>
  </blockquote>