Rookie Powershell question
I am working on some Active Sync statistics, and I'm googling for Powershell commands. What do I do if I find a tip saying;
$UserList = Get-CASMailbox
-Filter hasactivesyncdevicepartnership
-eq $true -and -not displayname
-like "CAS_{*"}
| Get-Mailbox
$UserList | foreach {
Get-ActiveSyncDeviceStatistics
-Mailbox $_.Identity}
I thought I could copy these two lines into a textfile and call it something.ps1, making it a Powershell script, and then run it. But no. How do I do it? Sorry for a laim question, but I'm a total rookie.
October 18th, 2012 5:56am
Hi
you have some bugs in this command, below should work correctly:
$UserList = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and displayname -notlike "CAS_{*}"} | Get-Mailbox
$UserList | foreach { Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}
it will be better to understand you if you write what you want to get as a result of this command :)
also if you have more than 1000 mailboxes you have to use -ResultSize Unlimited
Regards
Remigiusz
ExchangeBlog
Free Windows Admin Tool Kit Click here and download it now
October 18th, 2012 7:07am
Hi
check this link here you can find script to get all activesync devices connected to Exchange 2010 mailboxes.
Exchange 2010 ActiveSync Devices list
Remigiusz
ExchangeBlog
October 19th, 2012 12:55am
Hello,
After you saved the script as something.ps1 file, you can follow this document to run the script:
Scripting with the Exchange Management Shell
http://technet.microsoft.com/en-us/library/bb123798.aspx
Thanks,
EvanEvan Liu
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
October 19th, 2012 5:19am