-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetmailboxstatistics.ps1
219 lines (108 loc) · 7.72 KB
/
Getmailboxstatistics.ps1
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# .SYNOPSIS
# getmailboxstatistics.ps1
# This script gets all mailboxes statistics
#
# The script needs to be run from Exchange Online.
# Please run the script from Windows Azure Active Directory Module for Windows PowerShell
#
# .DESCRIPTION
#
# Copyright (c) 2015 Microsoft Corporation. All rights reserved.
#
# THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK
# OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
$path = Read-Host "Please enter the path and name to save the CVS file"
Write-Host "Filtering letter A"
$filter = "a*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "b*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "c*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
Write-Host "Filtering letter D"
$filter = "d*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "e*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "f*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "g*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
Write-Host "Filtering letter H"
$filter = "h*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "i*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "j*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Write-Host "Filtering letter K"
$filter = "k*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "l*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "m*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "n*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Write-Host "Filtering letter O"
$filter = "o*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "p*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "q*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
Write-Host "Filtering letter R"
$filter = "r*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "s*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "t*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "u*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "v*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Write-Host "Filtering letter W"
$filter = "w*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "x*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "y*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Start-Sleep -m 2000
$filter = "z*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Write-Host "Filtering numeric from 0 to 9"
$filter = "0*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "1*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "2*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "3*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "4*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "5*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "6*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "7*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "8*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
$filter = "9*"
Get-Mailbox -Filter "Alias -like '$filter'" | Get-MailboxStatistics | Select-Object DisplayName,IsArchiveMailbox,ItemCount,TotalItemSize | Export-Csv -Append $path
Import-CSV $path | Out-GridView -Title "Mailbox Statistics"