KevinKhanMCITP
asked on
Removing Old ActiveSync Devices Exchange 2010 Powershell
Any suggestions on what I'm doing wrong with this script?
Error Message: "Cannot process argument transformation on parameter 'Identity'. Cannot convert the "8712635a-1ec2-4860-a654-1 21167c888d 9" value of type "System.Guid" to type "Microsoft.Exchange.Config uration.Ta sks.Active SyncDevice IdParamete r".
+ CategoryInfo : InvalidData: (:) [Remove-ActiveSyncDevice], ParameterBindin...mationEx ception
+ FullyQualifiedErrorId : ParameterArgumentTransform ationError ,Remove-Ac tiveSyncDe vice"
However, when I use the GUID property tag in an individual "remove-activesyncdevice" cmdlet...it works.
Also, if I use the $_.Identity variable in place of the $_.GUID variable it works for some users but has trouble with others. Saying it cannot find the recipient
$Mailboxes = $null
$Devices = $null
$Mailboxes = Get-CASMailbox -Filter {HasActivesyncDevicePartnership -eq $true} -resultsize Unlimited
$Devices = $Mailboxes | %{Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity} | ?{($_.LastSuccessSync -ne $null) -and ($_.LastSuccessSync -le (Get-Date).AddDays(-14))}
$Devices | %{Remove-ActiveSyncDevice -identity $_.guid}
Error Message: "Cannot process argument transformation on parameter 'Identity'. Cannot convert the "8712635a-1ec2-4860-a654-1
+ CategoryInfo : InvalidData: (:) [Remove-ActiveSyncDevice],
+ FullyQualifiedErrorId : ParameterArgumentTransform
However, when I use the GUID property tag in an individual "remove-activesyncdevice" cmdlet...it works.
Also, if I use the $_.Identity variable in place of the $_.GUID variable it works for some users but has trouble with others. Saying it cannot find the recipient
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For readers,
This script finds All ActieSync Devices that have not successfully sync'd with the Exchange Server longer than 14 days only excluding the devices that have not reported back to the Exchange Server (leaving the lastsuccesssync field $null)
This script finds All ActieSync Devices that have not successfully sync'd with the Exchange Server longer than 14 days only excluding the devices that have not reported back to the Exchange Server (leaving the lastsuccesssync field $null)
ASKER