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!