Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

hashtable add a value

$
0
0

Hello together

i write a script which gives me all the mobile phone and the OS-Versions of my firm.

And at the end the script should count how many mobile phones have the respective OS-Versions.

And my question is now how can i add the OS-Versions to a empty hash table.

Here is my script.

Powershell
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$s=New-PSSession-ConfigurationNameMicrosoft.Exchange-ConnectionUrihttp://srv00832/powershell-AuthenticationKerberosImport-PSSession$s-EASilentlyContinue$Zaehler=0$iPhoneiOS=0$AppleGeraete=0$iPhoneHashiOS=@{}[Array]$ADUser=Get-CASMailbox-ResultSize25|Where{$_.HasActiveSyncDevicePartnership-eq$TRUE}foreach($Userin$ADUser){$Zaehler++$AcSyDeStatisticList=Get-ActiveSyncDeviceStatistics-Mailbox$($User.SamAccountName)foreach($AcSyDeStatisticin$AcSyDeStatisticList){$LastSyncTime=$($AcSyDeStatistic.LastSuccessSync)If($LastSyncTime-ne$null){$LastSyncDiff=$LastSyncTime-$(Get-Date)If($LastSyncDiff-gt$Zeitraum){if(($($AcSyDeStatistic.DeviceOS)-eq$null)-and($($AcSyDeStatistic.DeviceUserAgent)-like"Apple*")){$iPhoneiOS++}if($($AcSyDeStatistic.DeviceUserAgent)-like"Apple*"){$AppleGeraete++}ForEach($KeyNamein@($AcSyDeStatistic.DeviceOS)){$iPhoneHashiOS.$KeyName=0$iPhoneHashiOS.key.Remove((Where-Object-Like"Windows*"))}foreach($keyin[object[]]$iPhoneHashiOS.Keys){if($AcSyDeStatistic.DeviceOS-like$key){$iPhoneHashiOS[$key]++}}}}}}

Thanks for your help

Bye Dominique 

Geben Sie Text oder eine Website-Adresse ein oder lassen Sie ein Dokument übersetzen.

Geben Sie Text oder eine Website-Adresse ein oder lassen Sie ein Dokument übersetzen.

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>