have done some searching and I try to use this script but keep getting this error message: Expressions are only allowed as the first element of a pipeline.
At line:1 char:107
+ get-casmailbox -filter * | {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"} <<<< ;| foreach {$name = $_.name; $device = get-activesync devicestatistics -m
ailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} }
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline
This is the script I am using: get-casmailbox -filter * | {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"};| foreach {$name = $_.name; $device = get-activesync devicestatistics -mailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} }
Thanks for helping.
Lynn
At line:1 char:107
+ get-casmailbox -filter * | {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"} <<<< ;| foreach {$name = $_.name; $device = get-activesync devicestatistics -m
ailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} }
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline
This is the script I am using: get-casmailbox -filter * | {HasActivesyncDevicePartnership -eq $true -and -not DisplayName -like "CAS_{*"};| foreach {$name = $_.name; $device = get-activesync devicestatistics -mailbox $_.identity; $device | foreach {write-host $mbx.name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} }
Thanks for helping.
Lynn