Hello Together
I’m working on a script, which make a list with all the handy’s of our company and and compare the OS of the handys with a list(hashtable) with OS from Apple.
For every match the Os in the hashtable will be increased to 1.
And i have no idea how i could make, that the OS in the Hashtable will be increased to 1.
Here is the script:
$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://srv00832/powershell -Authentication Kerberos
Import-PSSession $s -EA SilentlyContinue
$Zaehler = 0
$iPhoneiOS = 0
$AppleGeraete = 0
$iPhoneHashiOS = @{“iOS 6.0*” = 0; “iOS 6.1 *” = 0; “iOS 6.1.1 *” = 0; “iOS 6.1.2 *” = 0; “iOS 6.1.3 *” = 0; “iOS 7.0 *” = 0; “iOS 7.0.2 *” = 0; “iOS 7.0.3 *” = 0; “iOS 7.0.4 *” = 0; “iOS 7.1 *” = 0}
[Array]$ADUser = Get-CASMailbox -ResultSize 20 | Where {$_.HasActiveSyncDevicePartnership -eq $TRUE}
foreach ($User in $ADUser)
{
$Zaehler++
$AcSyDeStatisticList = Get-ActiveSyncDeviceStatistics -Mailbox $($User.SamAccountName)
foreach ($AcSyDeStatistic in $AcSyDeStatisticList)
{
$LastSyncTime = $($AcSyDeStatistic.LastSuccessSync)
If ($LastSyncTime -ne $null)
{
$LastSyncDiff = $LastSyncTime - $(Get-Date)
If ($LastSyncDiff -gt $Zeitraum)
{
$iPhoneHashiOS | foreach-object {if($AcSyDeStatistic.DeviceOS -ne $iPhoneHashiOS){$iPhoneHashiOS.Add($AcSyDeStatistic.DeviceOS, 1)}
$iPhoneHashiOS = $iPhoneHashiOS | select -Unique
if (($($AcSyDeStatistic.DeviceOS) -eq $null) -and ($($AcSyDeStatistic.DeviceUserAgent) -like “Apple*”)){$iPhoneiOS++}
if ($($AcSyDeStatistic.DeviceUserAgent) -like “Apple*”){$AppleGeraete++}
}
}
}
}
I hope that someone can help me
bye Dominique
P.S: Sorry for my bad english