-----提供AD\Exchange\Lync\Sharepoint\CRM\SC\O365等微软产品实施及外包,QQ:185426445.电话18666943750
get-activesyncdevice 获取当前用户拥有的使用activesync 协议的移动设备信息
get-activesyncdevicestatistics 获取当前设备的连接信息
exchange 2013命令已经更改成如下命令:
Get-MobileDevice 获取当前用户拥有的使用activesync 协议的移动设备信息
Get-MobileDeviceStatistics 获取当前设备的连接信息
脚本如下:
Add-PSSnapin microsoft.exchange*
$device=Get-MobileDevice -ResultSize unlimited | foreach-Object {$_.identity}
$userlist = @()
foreach($i in $device)
{
$DeviceStatistics=Get-MobileDeviceStatistics $i
$username=Get-mobileDevice $i | select-object UserDisplayName,Name,FriendlyName,DeviceType,DeviceModel,FirstSyncTime | Sort-Object UserDisplayName
$userobject=New-object psobject
$userobject | Add-Member -membertype noteproperty -Name 登录名 -value $username.UserDisplayName
$userobject | Add-Member -membertype noteproperty -Name 设备详细名称 -Value $username.Name
$userobject | Add-Member -membertype noteproperty -Name 设备名称 -Value $username.FriendlyName
$userobject | Add-Member -membertype noteproperty -Name 设备类型 -Value $username.DeviceType
$userobject | Add-Member -membertype noteproperty -Name 设备型号 -Value $username.DeviceModel
$userobject | Add-Member -membertype noteproperty -Name 第一次同步时间 -Value $username.FirstSyncTime
$userobject | Add-Member -membertype noteproperty -Name 设备状态 -Value $DeviceStatistics.Status
$userobject | Add-Member -membertype noteproperty -Name 最后一次同步时间 -Value $DeviceStatistics.LastSuccessSync
$userlist+=$userobject
echo $userlist
}
$userlist | Export-csv -Path c:\"移动设备登录情况汇总表.csv" -NoTypeInformation -Encoding utf8
最后效果如下图: