forked from VeeamHub/powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudit.ps1
828 lines (720 loc) · 24.8 KB
/
audit.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# =======================================================
# NAME: VBM365audit.ps1
# AUTHOR: Commenge Damien, Axians Cloud Builder
# DATE: 11/07/2022
#
# VERSION 1.05
# COMMENTS: This script is created to Audit Veeam backup for microsoft 365
# <N/A> is used for not available
# =======================================================
<#
# 16/07/2022
Update lot of code for better performance
# 18/07/2022
Change date format and replace VBM to VB365
# 26/07/2022
Optimize path creation
# 09/08/2023
Add storage account
Add backup copy
Add encryption key
Add Teams graph API
#>
# =======================================================
#Requires -Modules @{ ModuleName="Veeam.Archiver.PowerShell"; ModuleVersion="6.0" }
#Date to create folder
$Date = Get-Date -Format "yyyy-MM-dd HH_mm"
#ReportPath to create folder
$ReportPath="C:\temp\VBM365Audit\$Date"
#Create folder
New-Item -ItemType Directory -Path $ReportPath -Force | Out-Null
#Report path
$HTMLReportPath = "$ReportPath\VeeamBackupMicrosoft365.html"
#Web page title
$HTMLTitle = "VBM365 report"
#Web page CSS style
$HTMLCSS = @'
<style>
body{color:black;font-family:Vinci Sans Light;font-size:0.79em;line-height:1.25;margin:5;}
a{color:black;}
H1{color:white;font-family:Verdana;font-weight:bold;font-size:20pt;margin-bottom:50px;margin-top:40px;text-align:center;background-color:#005EB8;}
H2{color:#A20067;font-family:Verdana;font-size:16pt;margin-left:14px;text-align:left;}
H3{color:#005EB8;font-family:Verdana;font-size:13pt;margin-left:16px;}
H4{color:black;font-family:Verdana;font-size:11pt;margin-left:16px;}
table {border-collapse: collapse;margin-left:10px;border-radius:7px 7px 0px 0px;}
th, td {padding: 8px;text-align: left;border-bottom: 1px solid #ddd;}
th {background-color: #006400;color: white;}
td:first-child{font-weight:bold;}
tr:nth-child(even){background-color: #f2f2f2}
table.table2 td:first-child{background-color: #A20067;color: white}
</style>
'@
#Connect to VBO Server
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - Connecting to VBM 365 server"
try {
Connect-VBOServer -ErrorAction Stop
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - Connected to VBM 365 server"
}
catch [System.Management.Automation.RuntimeException]{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - Connexion is already done"
}
catch {
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - $($_.Exception.message) " -ForegroundColor Red
return
}
<#
.SYNOPSIS
Get configuration Summary from Veeam Microsoft 365 server
.DESCRIPTION
Get server name, OS, OS build and VBM365 version
.EXAMPLE
Get-DCVB365Summary
#>
function Get-DCVB365Summary
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Summary"
$ServerName = $env:COMPUTERNAME
$ServerOS = (Get-CimInstance Win32_OperatingSystem).Caption
$OSBuild = Get-ItemPropertyValue -path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion" -name 'UBR'
$VB365build = (Get-VBOVersion).ProductVersion
[PScustomObject]@{
Name = $ServerName
OS = $ServerOS
OSBuild = $OSBuild
VB365Version = $VB365build
}
}
<#
.SYNOPSIS
Get configuration about organizations
.DESCRIPTION
Get organization name, account used, type (on premise, hybride, O365), service (exchange, sharepoint), region, authentication (basic, modern with legacy protocol, modern), auxiliar backup account/application number
.EXAMPLE
Get-DCVB365Organization
#>
function Get-DCVB365Organization
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Organization"
$Organization = Get-VBOOrganization
if ($Organization.Office365ExchangeConnectionSettings)
{
$OrgAuth = (Get-VBOOrganization).Office365ExchangeConnectionSettings.AuthenticationType
}
else
{
$OrgAuth = (Get-VBOOrganization).Office365SharePointConnectionSettings.AuthenticationType
}
if ($OrgAuth -eq "Basic")
{
$AuxAccount = (Get-VBOOrganization).backupaccounts.count
}
else
{
$AuxAccount = (Get-VBOOrganization).backupapplications.count
}
[PScustomObject]@{
Name = $Organization.OfficeName
Account = $Organization.username
Type = $Organization.type
Service = $Organization.BackupParts
Region = $Organization.region
Authentication = $OrgAuth
AuxAccount = $AuxAccount
}
}
<#
.SYNOPSIS
Get configuration about backup job configuration
.DESCRIPTION
Get job name, type, included object, excluded object, repository, proxy, schedule, active or disabled state
.EXAMPLE
Get-DCVB365BackupJob
#>
function Get-DCVB365BackupJob
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Backup Jobs"
foreach ($Job in Get-VBOJob)
{
#Get proxy name from associated proxy ID repository
$JobSchedule = "<N/A>"
if ($Job.schedulepolicy.EnableSchedule -and $Job.SchedulePolicy.Type -eq "daily")
{
$JobSchedule = [string]$Job.SchedulePolicy.DailyTime + " " + $Job.SchedulePolicy.DailyType
}
if ($Job.schedulepolicy.EnableSchedule -and $Job.SchedulePolicy.Type -eq "Periodically")
{
$JobSchedule = $Job.SchedulePolicy.PeriodicallyEvery
}
[PScustomObject]@{
Name = $Job.Name
Type = $Job.JobBackupType
InclObject = $Job.SelectedItems -join ", "
ExclObject = $Job.ExcludedItems -join ", "
Repository = $Job.Repository
Proxy = (Get-VBOProxy -id (Get-VBORepository -Name $Job.Repository).Proxy.Id -ExtendedView:$False).Hostname
Schedule = $JobSchedule
Enabled = $Job.IsEnabled
}
}
}
<#
.SYNOPSIS
Get configuration about backup copy job configuration
.DESCRIPTION
Get job name, repository, backupjob linked, schedule, active or disabled state
.EXAMPLE
Get-DCVB365BackupCopyJob
#>
function Get-DCVB365BackupCopyJob
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Backup copy Jobs"
$CopyJobs = Get-VBOCopyJob
if ($CopyJobs)
{
foreach ($CopyJob in $CopyJobs)
{
if ($CopyJob.SchedulePolicy.Type -eq "daily")
{
$JobSchedule = [string]$CopyJob.SchedulePolicy.DailyTime + " " + $CopyJob.SchedulePolicy.DailyType
}
if ($CopyJob.SchedulePolicy.Type -eq "Periodically")
{
$JobSchedule = $CopyJob.SchedulePolicy.PeriodicallyEvery
}
else
{
$JobSchedule = $CopyJob.SchedulePolicy.Type
}
[PScustomObject]@{
Name = $CopyJob.name
Repository = $CopyJob.Repository
BackupLinked = $CopyJob.BackupJob.name
Schedule = $JobSchedule
Enabled = $CopyJob.IsEnabled
}
}
}
else
{
[PScustomObject]@{
Name = "<N/A>"
Repository = "<N/A>"
BackupLinked = "<N/A>"
Schedule = "<N/A>"
Enabled = "<N/A>"
}
}
}
<#
.SYNOPSIS
Get configuration about proxy configuration
.DESCRIPTION
Get proxy name, port, thread number, throttling, internet proxy used or not, internet proxy port and account
.EXAMPLE
Get-DCVB365Proxy
#>
function Get-DCVB365Proxy
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Proxy"
foreach ($Proxy in (Get-VBOProxy -ExtendedView:$False))
{
$Proxy = [PScustomObject]@{
Name = $Proxy.hostname
Port = $Proxy.port
Thread = $Proxy.ThreadsNumber
Throttling = [string]$Proxy.ThrottlingValue + " " + $Proxy.ThrottlingUnit
IntProxyHost = "<N/A>"
IntProxyPort = "<N/A>"
IntProxyAccount = "<N/A>"
}
if ($Proxy.InternetProxy.UseInternetProxy)
{
$Proxy.IntProxyHost = $Proxy.InternetProxy.UseInternetProxy.Host
$Proxy.IntProxyPort = $Proxy.InternetProxy.UseInternetProxy.Port
$Proxy.IntProxyAccount = $Proxy.InternetProxy.UseInternetProxy.User
}
}
$Proxy
}
<#
.SYNOPSIS
Get configuration about repository configuration
.DESCRIPTION
Get repository name, proxy associated, path, retention type and value, repository object name and encryption
.EXAMPLE
Get-DCVB365Repository
#>
function Get-DCVB365Repository
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Repository"
foreach ($Repository in Get-VBORepository)
{
$Proxy = (Get-VBOProxy -id (Get-VBORepository -name $Repository.Name).Proxy.Id -ExtendedView:$False).Hostname
$Retention = [string]$Repository.RetentionPeriod + " " + $Repository.RetentionType
$ObjectName = "<N/A>"
if ($Repository.ObjectStorageRepository)
{
$ObjectName = $Repository.ObjectStorageRepository.Name
}
[int]$UsedStorage = ($Repository.Capacity - $Repository.FreeSpace) / 1GB
[int]$TotalStorage = $Repository.Capacity / 1GB
[PScustomObject]@{
Name = $Repository.Name
Proxy = $Proxy
Path = $Repository.Path
ObjectRepository = $ObjectName
Retention = $Retention
Encryption = $Repository.EnableObjectStorageEncryption
'Storage(GB)' = [String]$UsedStorage + "/" + $TotalStorage
}
}
}
<#
.SYNOPSIS
Get configuration about object repository configuration
.DESCRIPTION
Get repository name, folder, type, UsedSpace, size limit and if it's long term achive
.EXAMPLE
Get-DCVB365ObjectRepository
#>
function Get-DCVB365ObjectRepository
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Object Repository"
foreach ($ObjectStorage in Get-VBOObjectStorageRepository)
{
$SizeLimit = "<N/A>"
if ($ObjectStorage.EnableSizeLimit)
{
$SizeLimit = [String]$ObjectStorage.UsedSpace + "/" + $ObjectStorage.SizeLimit
}
[PScustomObject]@{
Name = $ObjectStorage.name
Folder = $ObjectStorage.Folder
Type = $ObjectStorage.Type
'UsedSpace(GB)' = [int]($ObjectStorage.UsedSpace / 1GB)
SizeLimit = $SizeLimit
LongTerm = $ObjectStorage.IsLongTerm
}
}
}
<#
.SYNOPSIS
Get configuration about license
.DESCRIPTION
Get license type, expiration date, customer, contact, usage
.EXAMPLE
Get-DCVB365License
#>
function Get-DCVB365License
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 License"
$License = (Get-VBOLicense)
$Usage = [string]$License.usedNumber + "/" + (Get-VBOLicense).TotalNumber
[PScustomObject]@{
Type = $License.Type
Expiration = $License.ExpirationDate.ToUniversalTime().ToString("yyyy/MM/dd")
To = $License.LicensedTo
Contact = $License.ContactPerson
Number = $Usage
}
}
<#
.SYNOPSIS
Get configuration about restore operator configuration
.DESCRIPTION
Get role name, organization, operator, associated object, excluded object
.EXAMPLE
Get-DCVB365RestoreOperator
#>
function Get-DCVB365RestoreOperator
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Restore Operator"
$Roles = Get-VBORbacRole
if ($role)
{
foreach ($Role in $Roles)
{
$IncludedObject = "Organization"
$ExcludedObject = "<N/A>"
if ($Role.RoleType -ne "EntireOrganization")
{
$IncludedObject = $Role.SelectedItems.DisplayName -join ", "
}
if ($Role.ExcludedItems)
{
$ExcludedObject = $Role.ExcludedItems.DisplayName -join ", "
}
[PScustomObject]@{
Role = $Role.Name
Organization = (Get-VBOOrganization -Id ($Role.OrganizationId)).Name
Operator = $Role.Operators.DisplayName -join ", "
IncludedObject = $IncludedObject
ExcludedObject = $ExcludedObject
}
}
}
else
{
[PScustomObject]@{
Role = "<N/A>"
Organization = "<N/A>"
Operator = "<N/A>"
IncludedObject = "<N/A>"
ExcludedObject = "<N/A>"
}
}
}
<#
.SYNOPSIS
Get configuration about RestAPI configuration
.DESCRIPTION
Get state, token life time, port, certificate thumbprint friendly name and expiration date
.EXAMPLE
Get-DCVB365RestAPI
#>
function Get-DCVB365RestAPI
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 REST API"
$RestAPI = Get-VBORestAPISettings
[PScustomObject]@{
Enabled = $RestAPI.IsServiceEnabled
CertThumbprint = $RestAPI.CertificateThumbprint
CertFriendlyName = $RestAPI.CertificateFriendlyName
CertExpiration = $RestAPI.CertificateExpirationDate.ToUniversalTime().ToString("yyyy/MM/dd")
TokenTime = $RestAPI.AuthTokenLifeTime
Port = $RestAPI.HTTPSPort
}
}
<#
.SYNOPSIS
Get configuration about Restore portal configuration
.DESCRIPTION
Get state, application ID, certificate thumbprint friendly name and expiration date
.EXAMPLE
Get-DCVB365RestorePortal
#>
function Get-DCVB365RestorePortal
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Restore portal"
$RestorePortal = Get-VBORestorePortalSettings
[PScustomObject]@{
Enabled = $RestorePortal.IsServiceEnabled
CertThumbprint = $RestorePortal.CertificateThumbprint
CertFriendlyName = $RestorePortal.CertificateFriendlyName
CertExpiration = $RestorePortal.CertificateExpirationDate.ToUniversalTime().ToString("yyyy/MM/dd")
AzureApplicationID = $RestorePortal.ApplicationId.Guid
}
}
<#
.SYNOPSIS
Get configuration about operator Authentication portal configuration
.DESCRIPTION
Get state, certificate thumbprint friendly name and expiration date
.EXAMPLE
Get-DCVB365OperatorAuthentication
#>
function Get-DCVB365OperatorAuthentication
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Authentication"
$OperatorAuthentication = Get-VBOOperatorAuthenticationSettings
[PScustomObject]@{
Enabled = $OperatorAuthentication.AuthenticationEnabled
CertThumbprint = "InFutureVersion"
CertFriendlyName = $OperatorAuthentication.CertificateFriendlyName
CertExpiration = $OperatorAuthentication.CertificateExpirationDate.ToUniversalTime().ToString("yyyy/MM/dd")
}
}
<#
.SYNOPSIS
Get configuration about internet proxy
.DESCRIPTION
Get state, host, port and account
.EXAMPLE
Get-DCVB365InternetProxy
#>
function Get-DCVB365InternetProxy
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Internet Proxy"
$InternetProxySetting = Get-VBOInternetProxySettings
$InternetProxy = [PScustomObject]@{
Enabled = $InternetProxySetting.UseInternetProxy
Host = "<N/A>"
Port = "<N/A>"
Account = "<N/A>"
}
if ($InternetProxySetting.UseInternetProxy)
{
$InternetProxy.Host = $InternetProxySetting.Host
$InternetProxy.Port = $InternetProxySetting.Port
$InternetProxy.Account = $InternetProxySetting.User
}
$InternetProxy
}
<#
.SYNOPSIS
Get configuration about SMTP
.DESCRIPTION
Get state, server, port, ssl, account, type
.EXAMPLE
Get-DCVB365SMTP
#>
function Get-DCVB365SMTP
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 SMTP configuration"
$SMTPSetting = Get-VBOEmailSettings
$Type = if ($SMTPSetting.AuthenticationType -eq "CustomSmtp")
{
"SMTP authentication"
}
else
{
$SMTPSetting.AuthenticationType
}
$SMTP = [PScustomObject]@{
Enabled = $SMTPSetting.EnableNotification
Type = "<N/A>"
Server = "<N/A>"
Port = "<N/A>"
SSL = "<N/A>"
Account = "<N/A>"
}
if ($SMTPSetting.EnableNotification)
{
$SMTP.Type = $Type
if ($Type -eq "SMTP authentication")
{
$SMTP.Port = $SMTPSetting.Port
$SMTP.Server = $SMTPSetting.SMTPServer
$SMTP.SSL = $SMTPSetting.UseSSL
if ($SMTPSetting.UseAuthentication)
{
$SMTP.Account = $SMTPSetting.Username
}
}
else
{
$SMTP.Server = $SMTPSetting.MailApiUrl
$SMTP.Account = $SMTPSetting.UserId
}
}
$SMTP
}
<#
.SYNOPSIS
Get configuration about Notifications
.DESCRIPTION
Get state, sender, receiver, notification on success, warning and failure, send only last retry notification
.EXAMPLE
Get-DCVB365Notification
#>
function Get-DCVB365Notification
{
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Notifications"
$NotificationSetting = (Get-VBOEmailSettings)
$Notification = [PScustomObject]@{
Enabled = $NotificationSetting.EnableNotification
Sender = "<N/A>"
Receiver = "<N/A>"
Success = "<N/A>"
Warning = "<N/A>"
Failure = "<N/A>"
LastRetry = "<N/A>"
}
if ($NotificationSetting.EnableNotification)
{
$Notification.Sender = $NotificationSetting.From -join ", "
$Notification.Receiver = $NotificationSetting.To -join ", "
$Notification.Success = $NotificationSetting.NotifyOnSuccess
$Notification.Warning = $NotificationSetting.NotifyOnWarning
$Notification.Failure = $NotificationSetting.NotifyOnFailure
$Notification.LastRetry = $NotificationSetting.SupressUntilLastRetry
}
$Notification
}
<#
.SYNOPSIS
Get configuration about cloud storage account
.DESCRIPTION
Get account, type and description
.EXAMPLE
Get-DCVB365StorageAccount
#>
function Get-DCVB365StorageAccount
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Cloud storage account"
#Azure storage account
$AzureAccount = Get-VBOAzureBlobAccount
foreach ($account in $AzureAccount)
{
[PSCustomObject]@{
Account = $Account.Name
Type = "Azure Blob"
Description = $Account.Description
}
}
#Amazon storage account
$AmazonAccount = Get-VBOAmazonS3Account
foreach ($account in $AmazonAccount)
{
[PSCustomObject]@{
Account = $Account.AccessKey
Type = "Amazon S3"
Description = $Account.Description
}
}
#S3 compatible storage account
$S3Compatible = Get-VBOAmazonS3CompatibleAccount
foreach ($account in $S3Compatible)
{
[PSCustomObject]@{
Account = $Account.AccessKey
Type = "Amazon S3"
Description = $Account.Description
}
}
}
<#
.SYNOPSIS
Get configuration about cloud storage account
.DESCRIPTION
Get account, type and description
.EXAMPLE
Get-DCVB365StorageAccount
#>
function Get-DCVB365EncryptionKey
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Encryption key"
$EncryptionKey = Get-VBOEncryptionKey
foreach ($obj in $EncryptionKey)
{
$repository = Get-VBORepository | Where-Object {$_.ObjectStorageEncryptionKey.ID.Guid -eq $obj.Id.Guid}
[PSCustomObject]@{
Repository = $repository.Name
Description = $obj.Description
}
}
}
<#
.SYNOPSIS
Get configuration about Teams Graph API state on VBM365 and proxy
.DESCRIPTION
Get Teams graph API state enabled or disabled on all proxies and Veeam 365 server
.EXAMPLE
Get-DCVB365StorageAccount
#>
function Get-DCVB365TeamsGraphAPIState
{
Write-host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Teams graph api state"
#VBM365 server
[PSCustomObject]@{
Server = $env:COMPUTERNAME
TeamsGraphApi = (Get-VBOServer).IsTeamsGraphAPIBackupEnabled
}
$Proxy = Get-VBOProxy
foreach ($obj in $Proxy)
{
If ($obj.Hostname -ne $env:COMPUTERNAME)
{
[PSCustomObject]@{
Server = $obj.Hostname
TeamsGraphApi = $obj.IsTeamsGraphAPIBackupEnabled
}
}
}
}
##########################################################################
<#
.SYNOPSIS
Generate HTML report
.DESCRIPTION
Use all variable to build html report with CSS style
.EXAMPLE
Get-HTMLReport -Path "C:\temp\report.html"
#>
Function Get-HTMLReport
{
[CmdletBinding()]
Param
(
#HTML file path
[Parameter(Mandatory)]
[System.IO.FileInfo]$Path
)
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm") - VBM365 Building HTML"
#region HTML
# chrisdent: STYLE: In the code below `CreateArray` is something of a misleading function name.
# chrisdent: ENHANCEMENT: Perhaps consider using a string builder.
@"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>$HTMLTitle</title>
$HTMLCSS
</head>
<body>
<br><br><br><br>
<h1>VEEAM Backup for Microsoft 365 Report</h1>
<h3> Summary </h3>
$($DCVB365Summary)
<h3> License </h3>
$DCVB365License
<h3> SMTP </h3>
$DCVB365SMTP
<h3> Notification </h3>
$DCVB365Notification
<h3> Web Proxy </h3>
$DCVB365InternetProxy
<h3> REST API </h3>
$DCVB365RestAPI
<h3> Restore portal </h3>
$DCVB365RestorePortal
<h3> Restore operator authentication </h3>
$DCVB365OperatorAuthentication
<h3> Repository </h3>
$DCVB365Repository
<h3> Object Repository </h3>
$DCVB365ObjectRepository
<h3> Organisation </h3>
$DCVB365Organization
<h3> Proxy </h3>
$DCVB365Proxy
<h3> Backup job </h3>
$DCVB365BackupJob
<h3> Backup copy job </h3>
$DCVB365BackupCopyJob
<h3> Restore operators </h3>
$DCVB365RestoreOperator
<h3> Cloud storage account </h3>
$DCVB365StorageAccount
<h3> Encryption key </h3>
$DCVB365EncryptionKey
<h3> Teams graph API state </h3>
$DCVB365TeamsGraphAPIState
</body>
</html>
"@ | Out-File -FilePath $HTMLReportPath
Invoke-Item $HTMLReportPath
}
#endregion
#Write here all function that need to be displayed in all reports types
$DCVB365Summary = Get-DCVB365Summary | ConvertTo-Html -Fragment
$DCVB365Organization = Get-DCVB365Organization | Sort-object Name | ConvertTo-Html -Fragment
$DCVB365BackupJob = Get-DCVB365BackupJob | Sort-object Name | ConvertTo-Html -Fragment
$DCVB365Proxy = Get-DCVB365Proxy | Sort-object Name | ConvertTo-Html -Fragment
$DCVB365Repository = Get-DCVB365Repository | Sort-object Name | ConvertTo-Html -Fragment
$DCVB365License = Get-DCVB365License | ConvertTo-Html -Fragment
$DCVB365RestoreOperator = Get-DCVB365RestoreOperator | ConvertTo-Html -Fragment
$DCVB365RestAPI = Get-DCVB365RestAPI | ConvertTo-Html -Fragment
$DCVB365RestorePortal = Get-DCVB365RestorePortal | ConvertTo-Html -Fragment
$DCVB365OperatorAuthentication = Get-DCVB365OperatorAuthentication | ConvertTo-Html -Fragment
$DCVB365InternetProxy = Get-DCVB365InternetProxy | ConvertTo-Html -Fragment
$DCVB365SMTP = Get-DCVB365SMTP | ConvertTo-Html -Fragment
$DCVB365Notification = Get-DCVB365Notification | ConvertTo-Html -Fragment
$DCVB365ObjectRepository = Get-DCVB365ObjectRepository | Sort-object Name | ConvertTo-Html -Fragment
$DCVB365BackupCopyJob = Get-DCVB365BackupCopyJob | Sort-object Name | ConvertTo-Html -Fragment
$DCVB365StorageAccount = Get-DCVB365StorageAccount | Sort-object Type | ConvertTo-Html -Fragment
$DCVB365EncryptionKey = Get-DCVB365EncryptionKey | ConvertTo-Html -Fragment
$DCVB365TeamsGraphAPIState = Get-DCVB365TeamsGraphAPIState | ConvertTo-Html -Fragment
#Create HTML Report.
Get-HTMLReport -Path $HTMLReportPath
Disconnect-VBOServer