-
Notifications
You must be signed in to change notification settings - Fork 0
/
Listing 8.4.ps1
97 lines (91 loc) · 4.46 KB
/
Listing 8.4.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
$report = $reportpath
Clear-Content $report
###############################HTml Report Content############################
Add-Content $report "<html>"
Add-Content $report "<head>"
Add-Content $report "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
Add-Content $report '<title>Exchange Status Report</title>'
add-content $report '<STYLE TYPE="text/css">'
add-content $report "<!--"
add-content $report "td {"
add-content $report "font-family: Tahoma;"
add-content $report "font-size: 11px;"
add-content $report "border-top: 1px solid #999999;"
add-content $report "border-right: 1px solid #999999;"
add-content $report "border-bottom: 1px solid #999999;"
add-content $report "border-left: 1px solid #999999;"
add-content $report "padding-top: 0px;"
add-content $report "padding-right: 0px;"
add-content $report "padding-bottom: 0px;"
add-content $report "padding-left: 0px;"
add-content $report "}"
add-content $report "body {"
add-content $report "margin-left: 5px;"
add-content $report "margin-top: 5px;"
add-content $report "margin-right: 0px;"
add-content $report "margin-bottom: 10px;"
add-content $report ""
add-content $report "table {"
add-content $report "border: thin solid #000000;"
add-content $report "}"
add-content $report "-->"
add-content $report "</style>"
Add-Content $report "</head>"
Add-Content $report "<body>"
add-content $report "<table width='100%'>"
add-content $report "<tr bgcolor='Lavender'>"
add-content $report "<td colspan='7' height='25' align='center'>"
add-content $report "<font face='tahoma' color='#003399' size='4'><strong>DAG Active Manager</strong></font>"
add-content $report "</td>"
add-content $report "</tr>"
add-content $report "</table>"
add-content $report "<table width='100%'>"
Add-Content $report "<tr bgcolor='IndianRed'>"
Add-Content $report "<td width='10%' align='center'><B>Identity</B></td>"
Add-Content $report "<td width='5%' align='center'><B>PrimaryActiveManager</B></td>"
Add-Content $report "<td width='20%' align='center'><B>OperationalMachines</B></td>"
Add-Content $report "</tr>"
##############################Report Template##################################
add-content $report "<tr bgcolor='Lavender'>"
add-content $report "<td colspan='7' height='25' align='center'>"
add-content $report "<font face='tahoma' color='#003399' size='4'><strong>DAG Database Backup Status</strong></font>"
add-content $report "</td>"
add-content $report "</tr>"
add-content $report "</tr>"
add-content $report "</table>"
add-content $report "<table width='100%'>"
Add-Content $report "<tr bgcolor='IndianRed'>"
Add-Content $report "<td width='10%' align='center'><B>Database</B></td>"
Add-Content $report "<td width='5%' align='center'><B>BackupInProgress</B></td>"
Add-Content $report "<td width='10%' align='center'><B>SnapshotLastFullBackup</B></td>"
Add-Content $report "<td width='5%' align='center'><B>SnapshotLastCopyBackup</B></td>"
Add-Content $report "<td width='10%' align='center'><B>LastFullBackup</B></td>"
Add-Content $report "<td width='5%' align='center'><B>RetainDeletedItemsUntilBackup</B></td>"
$dbst= Get-MailboxDatabase | where{$_.MasterType -like "DatabaseAvailabilityGroup"}
$dbst | foreach{$st=Get-MailboxDatabase $_ -status
$dbname = $st.Name
$dbbkprg = $st.BackupInProgress
$dbsnpl = $st.SnapshotLastFullBackup
$dbsnplc= $st.SnapshotLastCopyBackup
$dblfb = $st.LastFullBackup
$dbrd = $st.RetainDeletedItemsUntilBackup
Add-Content $report "<tr>"
Add-Content $report "<td bgcolor= 'GainsBoro' align=center> <B>$dbname</B></td>"
Add-Content $report "<td bgcolor= 'GainsBoro' align=center> <B>$dbbkprg</B></td>"
Add-Content $report "<td bgcolor= 'GainsBoro' align=center> <B>$dbsnpl</B></td>"
Add-Content $report "<td bgcolor= 'GainsBoro' align=center> <B>$dbsnplc</B></td>"
if($dblfb -lt $hrs)
{
Add-Content $report "<td bgcolor= 'Red' align=center> <B>$dblfb</B></td>"
}
else
{
Add-Content $report "<td bgcolor= 'Aquamarine' align=center> <B>$dblfb</B></td>"
}
Add-Content $report "<td bgcolor= 'GainsBoro' align=center> <B>$dbrd</B></td>"
Add-Content $report "</tr>"
}
######################################################################################
Add-content $report "</table>"
Add-Content $report "</body>"
Add-Content $report "</html>"