在我们从 Exchange 2010 迁移到 Office365 和 ExchangeOnline 后,我删除移动设备的脚本似乎只会生成一个 Watson 转储,将我踢出并失败。有人有任何有效的修改吗?
原始脚本(修改为显示mobiledevice而不是activesyncdevice)
$DevicesToRemove = Get-MobileDevice -result unlimited | Get-MobileDeviceStatistics | where {$_.LastSuccessSync -le (Get-Date).AddDays("-3")} $DevicesToRemove | foreach-object {Remove-MobileDevice ([string]$_.Guid) -confirm:$false}
我尝试过的另一个脚本确实尝试删除,但要求确认每一个!
Get-CASMailbox -ResultSize unlimited –Filter {(HasActiveSyncDevicePartnership -eq $true) -AND (name -notlike "cas*") -AND (name -notlike "DiscoverysearchMailbox*")} | ForEach {Get-MobileDeviceStatistics -Mailbox $_.Identity | Where-Object {$_.LastSuccessSync -le ((Get-Date).AddDays("-14"))} | Remove-MobileDevice}
答案1
尝试确认选项:
Get-CASMailbox -ResultSize unlimited –Filter {(HasActiveSyncDevicePartnership -eq $true) -AND (name -notlike "cas*") -AND (name -notlike "DiscoverysearchMailbox*")} | ForEach {Get-MobileDeviceStatistics -Mailbox $_.Identity | Where-Object {$_.LastSuccessSync -le ((Get-Date).AddDays("-14"))} | Remove-MobileDevice -Confirm:$false}