AA-in-CA
asked on
Exchange 2007 SP3: Piping "Identity" parameter from Get-CASMailbox output to Get-ActiveSyncDeviceStatistics
Per this article on Exchangepedia, I can run the following command to generate a list of accounts with ActiveSync partnerships:
Get-CASMailbox -Filter {HasActiveSyncDevicePartne rship -eq $true} | Select Identity
[the article uses Select Name, but I found Select Identity works as well]
What I'd like to do is pass the output from this command to Get-ActiveSyncDeviceStatis tics, so I can determine the last time each user's 'ActiveSync-partnered' device authenticated against the server. How do I do this?
The overall idea here is to figure out which ActiveSync partnerships are stale/unusued.
Get-CASMailbox -Filter {HasActiveSyncDevicePartne
[the article uses Select Name, but I found Select Identity works as well]
What I'd like to do is pass the output from this command to Get-ActiveSyncDeviceStatis
The overall idea here is to figure out which ActiveSync partnerships are stale/unusued.
ASKER
Hi Will,
I tried the script, and Powershell threw an error saying Get-ActiveSyncMailboxStati stics isn't a valid cmdlet. Also had to remove the -nti parameter for export-csv. Thinking you meant Get-ActiveSyncDeviceStatis tics, I tried that, but only one user's results appear in the .csv.
I then manually tested Get-ActiveSyncDeviceStatis tics against a different user, one whom I know has used their device recently, and sure enough, Powershell returned results to that effect.
Why didn't this user (and the remaining ones) appear in the .CSV output?
I tried the script, and Powershell threw an error saying Get-ActiveSyncMailboxStati
I then manually tested Get-ActiveSyncDeviceStatis
Why didn't this user (and the remaining ones) appear in the .CSV output?
Sorry yes it should be Set not "get" my typo. What did not work? What is the exact error message?
Will.
Will.
ASKER
1) Sorry, what should be "Set", not "Get"?
2) That's the interesting thing. There's no error message, with my corrections the script runs, but the CSV only contains output for a single user. I checked the contents of $users in Powershell, and it output a list of the people with ActiveSync partnerships, as expected. Noticed something, though: the user that does appear in the CSV? He's the last user in the list.
2) That's the interesting thing. There's no error message, with my corrections the script runs, but the CSV only contains output for a single user. I checked the contents of $users in Powershell, and it output a list of the people with ActiveSync partnerships, as expected. Noticed something, though: the user that does appear in the CSV? He's the last user in the list.
ASKER
Here's the exact script I'm using, with modifications to make it run:
3 changes in all: Get-ActiveSyncMailboxStati stics became Get-ActiveSyncDeviceStatis tics, and I removed "nti" and "append" as parameters of export-csv (they wouldn't run with those parameters, probably because this is Exchange 2007/Server 2008?).
$users = Get-CASMailbox -ResultSize "unlimited" -Filter {HasActiveSyncDevicePartnership -eq $true}
ForEach ($user in $users) {
Get-ActiveSyncDeviceStatistics -Mailbox $user.name |
Export-csv "c:\CAB\ActiveSyncInfo.csv"
}
3 changes in all: Get-ActiveSyncMailboxStati
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
Thats it.
Will.