Getting users LastLogonTime on Live@edu using powershell

Posted by Eagles on Server Fault See other posts from Server Fault or by Eagles
Published on 2012-10-30T15:53:38Z Indexed on 2012/10/30 17:04 UTC
Read the original article Hit count: 239

Filed under:
|

I am trying to get a csv file of all users in a Live@edu environment with a LastLogonTime, but I am having some issues here is my script:

 foreach ($i in (Get-Mailbox -ResultSize unlimited)) 
      { Get-MailboxStatistics -LastLogonTime $i.DistinguishedName | where {$_.LastLogonTime} | select-object MailboxOwnerID,Name,LastLogonTime | export-csv -path "c:\filepath\UserLastLogon.csv" } 

I get the error:

 A positional paparameter cannot be found that accepts argument       '[email protected],OU=domain.edu,OU=Microsoft Exchange Hosted Organizations,DC=prod,DC=exchangelabs,DC=com'.

+Category Info: InvalidArgument: (:) [Get-MailboxStatistics], ParameterBindingException +FullyQualifiedErrorId : PositionalParameterNotFound,Get-MailboxStatistics

Any help would be great!

© Server Fault or respective owner

Related posts about powershell

Related posts about office-365