-
Notifications
You must be signed in to change notification settings - Fork 0
/
Listing 8.1.ps1
26 lines (21 loc) · 1.06 KB
/
Listing 8.1.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
$collection=@() #array to collect report data
$data = get-content .\users.txt #read samaccountname from text file
$data | foreach-object{
$coll = "" | Select Name,identity,WindowsEmailAddress,Database,ProhibitSendQuota,ProhibitSendReceiveQuota,IssueWarningQuota,employeeid, l,C #values needed in report
write-host "processig.............$_"
$getmbx = get-mailbox -identity $_
$getaduser = get-aduser -identity $_ -properties employeeid, l,C
$coll.Name = $getmbx.Name
$coll.identity = $getmbx.identity
$coll.WindowsEmailAddress = $getmbx.WindowsEmailAddress
$coll.Database= $getmbx.Database
$coll.ProhibitSendQuota = $getmbx.ProhibitSendQuota
$coll.ProhibitSendReceiveQuota = $getmbx.ProhibitSendReceiveQuota
$coll.IssueWarningQuota = $getmbx.IssueWarningQuota
$coll.employeeid = $getaduser.employeeid #note difference here
$coll.l = $getaduser.l
$coll.c = $getaduser.c
$collection+=$coll #add the collected values to the collecttion array
}
#now export to CSV file
$collection | Export-Csv .\report.csv -NoTypeInformation