Feel free to say what you would like if it’s missing I know it’s not “complete”
# ======================================================= # NAME: VBM365audit.ps1 # AUTHOR: Commenge Damien, Axians Cloud Builder # DATE: 11/07/2022 # # VERSION 1.0 # COMMENTS: This script is created to Audit Veeam backup for microsoft 365 # <N/A> is used for not available # =======================================================
<# .Synopsis Get configuration Summary from Veeam Microsoft 365 server .DESCRIPTION Get server name, OS, OS build and VBM365 version .EXAMPLE Get-DCVBMSummary #> function Get-DCVBMSummary { Write-host "$(get-date -Format HH:mm) - VBM365 Summary"
>PScustomObject]@{ Name = $VBM365ServerName OS = $VBM365ServerOS OSBuild = $OSBuild VBM365Version = $VBM365Version } }
<# .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-DCVBMOrganization #> function Get-DCVBMOrganization { Write-host "$(get-date -Format HH:mm) - VBM365 Organization"
>PScustomObject]@{ Name = $OrgName Account = $OrgAccount Type = $OrgType Service = $OrgService Region = $OrgRegion Authentication = $OrgAuth AuxAccount = $AuxAccount } }
<# .Synopsis Get configuration about job configuration .DESCRIPTION Get job name, type, included object, excluded object, repository, proxy, schedule, active or disabled state .EXAMPLE Get-DCVBMJob #> function Get-DCVBMJob { Write-host "$(get-date -Format HH:mm) - VBM365 Jobs"
<# .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-DCVBMProxy #> function Get-DCVBMProxy {
<# .Synopsis Get configuration about repository configuration .DESCRIPTION Get repository name, proxy associated, path, host, retention type and value .EXAMPLE Get-DCVBMRepository #> function Get-DCVBMRepository {
<# .Synopsis Get configuration about RestAPI configuration .DESCRIPTION Get state, token life time, port, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMRestAPI #> function Get-DCVBMRestAPI { Write-host "$(get-date -Format HH:mm) - VBM365 REST API"
<# .Synopsis Get configuration about Restore portal configuration .DESCRIPTION Get state, application ID, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMRestorePortal #> function Get-DCVBMRestorePortal {
<# .Synopsis Get configuration about operator Authentication portal configuration .DESCRIPTION Get state, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMOperatorAuthentication #> function Get-DCVBMOperatorAuthentication {
<# .Synopsis Get configuration about internet proxy .DESCRIPTION Get state, host, port and account .EXAMPLE Get-DCVBMInternetProxy #> function Get-DCVBMInternetProxy {
Write-host "$(get-date -Format HH:mm) - VBM365 Internet Proxy"
>PScustomObject]@{ Enabled = $SMTPEnabled Server = $SMTPServer Port = $SMTPPort SSL = $SMTPSSL Account = $SMTPAccount } }
<# .Synopsis Get configuration about Notifications .DESCRIPTION Get state, sender, receiver, notification on success, warning and failure, send only last retry notification .EXAMPLE Get-DCVBMNotification #> function Get-DCVBMNotification {
<# .Synopsis Create array for HTML report .DESCRIPTION Create array with title and precontent .EXAMPLE CreateArray -title "my Title" -var $MyData -PreContent $MyPrecontent #> Function CreateArray ($Title,$Var,$PreContent) { if ($Title) { "<h3>$Title</h3>" } if ($PreContent) { $Var | ConvertTo-Html -Fragment -PreContent $PreContent } else { $Var | ConvertTo-Html -Fragment } }
<# .Synopsis Generate HTML report .DESCRIPTION Use all variable to build html report with CSS style .EXAMPLE Get-HTMLReport -Path "c:\temp\report.html" #>
I add object repository + backup copy job settings
I’m waiting an answer on the forum for host repository name to be found I see it’s impossible to edit my previous post, new code is here :
# ======================================================= # NAME: VBM365audit.ps1 # AUTHOR: Commenge Damien, Axians Cloud Builder # DATE: 11/07/2022 # # VERSION 1.0 # COMMENTS: This script is created to Audit Veeam backup for microsoft 365 # <N/A> is used for not available # =======================================================
<# .Synopsis Get configuration Summary from Veeam Microsoft 365 server .DESCRIPTION Get server name, OS, OS build and VBM365 version .EXAMPLE Get-DCVBMSummary #> function Get-DCVBMSummary { Write-host "$(get-date -Format HH:mm) - VBM365 Summary"
rPScustomObject]@{ Name = $VBM365ServerName OS = $VBM365ServerOS OSBuild = $OSBuild VBM365Version = $VBM365Version } }
<# .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-DCVBMOrganization #> function Get-DCVBMOrganization { Write-host "$(get-date -Format HH:mm) - VBM365 Organization"
rPScustomObject]@{ Name = $OrgName Account = $OrgAccount Type = $OrgType Service = $OrgService Region = $OrgRegion 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-DCVBMBackupJob #> function Get-DCVBMBackupJob { Write-host "$(get-date -Format HH:mm) - VBM365 Backup Jobs"
<# .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-DCVBMProxy #> function Get-DCVBMProxy {
<# .Synopsis Get configuration about repository configuration .DESCRIPTION Get repository name, proxy associated, path, host, retention type and value, repository object name and encryption .EXAMPLE Get-DCVBMRepository #> function Get-DCVBMRepository {
<# .Synopsis Get configuration about object repository configuration .DESCRIPTION Get repository name, folder, type, size limit and if it's long term achive .EXAMPLE Get-DCVBMRepository #> function Get-DCVBMObjectRepository {
<# .Synopsis Get configuration about RestAPI configuration .DESCRIPTION Get state, token life time, port, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMRestAPI #> function Get-DCVBMRestAPI { Write-host "$(get-date -Format HH:mm) - VBM365 REST API"
<# .Synopsis Get configuration about Restore portal configuration .DESCRIPTION Get state, application ID, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMRestorePortal #> function Get-DCVBMRestorePortal {
<# .Synopsis Get configuration about operator Authentication portal configuration .DESCRIPTION Get state, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMOperatorAuthentication #> function Get-DCVBMOperatorAuthentication {
<# .Synopsis Get configuration about internet proxy .DESCRIPTION Get state, host, port and account .EXAMPLE Get-DCVBMInternetProxy #> function Get-DCVBMInternetProxy {
Write-host "$(get-date -Format HH:mm) - VBM365 Internet Proxy"
rPScustomObject]@{ Enabled = $SMTPEnabled Server = $SMTPServer Port = $SMTPPort SSL = $SMTPSSL Account = $SMTPAccount } }
<# .Synopsis Get configuration about Notifications .DESCRIPTION Get state, sender, receiver, notification on success, warning and failure, send only last retry notification .EXAMPLE Get-DCVBMNotification #> function Get-DCVBMNotification {
<# .Synopsis Create array for HTML report .DESCRIPTION Create array with title and precontent .EXAMPLE CreateArray -title "my Title" -var $MyData -PreContent $MyPrecontent #> Function CreateArray ($Title,$Var,$PreContent) { if ($Title) { "<h3>$Title</h3>" } if ($PreContent) { $Var | ConvertTo-Html -Fragment -PreContent $PreContent } else { $Var | ConvertTo-Html -Fragment } }
<# .Synopsis Generate HTML report .DESCRIPTION Use all variable to build html report with CSS style .EXAMPLE Get-HTMLReport -Path "c:\temp\report.html" #>
# ======================================================= # NAME: VBM365audit.ps1 # AUTHOR: Commenge Damien, Axians Cloud Builder # DATE: 11/07/2022 # # VERSION 1.01 # COMMENTS: This script is created to Audit Veeam backup for microsoft 365 # <N/A> is used for not available # =======================================================
<# .Synopsis Get configuration Summary from Veeam Microsoft 365 server .DESCRIPTION Get server name, OS, OS build and VBM365 version .EXAMPLE Get-DCVBMSummary #> function Get-DCVBMSummary { Write-host "$(get-date -Format HH:mm) - VBM365 Summary"
[PScustomObject]@{ Name = $VBM365ServerName OS = $VBM365ServerOS OSBuild = $OSBuild VBM365Version = $VBM365Build } }
<# .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-DCVBMOrganization #> function Get-DCVBMOrganization { Write-host "$(get-date -Format HH:mm) - VBM365 Organization"
[PScustomObject]@{ Name = $OrgName Account = $OrgAccount Type = $OrgType Service = $OrgService Region = $OrgRegion 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-DCVBMBackupJob #> function Get-DCVBMBackupJob { Write-host "$(get-date -Format HH:mm) - VBM365 Backup Jobs"
<# .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-DCVBMProxy #> function Get-DCVBMProxy {
<# .Synopsis Get configuration about repository configuration .DESCRIPTION Get repository name, proxy associated, path, retention type and value, repository object name and encryption .EXAMPLE Get-DCVBMRepository #> function Get-DCVBMRepository {
<# .Synopsis Get configuration about object repository configuration .DESCRIPTION Get repository name, folder, type, size limit and if it's long term achive .EXAMPLE Get-DCVBMRepository #> function Get-DCVBMObjectRepository {
<# .Synopsis Get configuration about RestAPI configuration .DESCRIPTION Get state, token life time, port, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMRestAPI #> function Get-DCVBMRestAPI { Write-host "$(get-date -Format HH:mm) - VBM365 REST API"
<# .Synopsis Get configuration about Restore portal configuration .DESCRIPTION Get state, application ID, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMRestorePortal #> function Get-DCVBMRestorePortal {
<# .Synopsis Get configuration about operator Authentication portal configuration .DESCRIPTION Get state, certificate thumbprint friendly name and expiration date .EXAMPLE Get-DCVBMOperatorAuthentication #> function Get-DCVBMOperatorAuthentication {
<# .Synopsis Get configuration about internet proxy .DESCRIPTION Get state, host, port and account .EXAMPLE Get-DCVBMInternetProxy #> function Get-DCVBMInternetProxy {
Write-host "$(get-date -Format HH:mm) - VBM365 Internet Proxy"
[PScustomObject]@{ Enabled = $SMTPEnabled Server = $SMTPServer Port = $SMTPPort SSL = $SMTPSSL Account = $SMTPAccount } }
<# .Synopsis Get configuration about Notifications .DESCRIPTION Get state, sender, receiver, notification on success, warning and failure, send only last retry notification .EXAMPLE Get-DCVBMNotification #> function Get-DCVBMNotification {
<# .Synopsis Create array for HTML report .DESCRIPTION Create array with title and precontent .EXAMPLE CreateArray -title "my Title" -var $MyData -PreContent $MyPrecontent #> Function CreateArray ($Title,$Var,$PreContent) { if ($Title) { "<h3>$Title</h3>" } if ($PreContent) { $Var | ConvertTo-Html -Fragment -PreContent $PreContent } else { $Var | ConvertTo-Html -Fragment } }
<# .Synopsis Generate HTML report .DESCRIPTION Use all variable to build html report with CSS style .EXAMPLE Get-HTMLReport -Path "c:\temp\report.html" #>
really a nice script. I have only two suggestions for improvement:
1st) I would create the directory for the report path after defining the $ReportPath variable and use the $ReportPath variable to create the folder. Like this:
#Report file HTML path $htmlReportPath = "$ReportPath\VeeamBackupMicrosoft365.html"
2nd) With my community edition, I received an error message when determining the expiration date of the license. So I would check the license type first. Like this:
really a nice script. I have only two suggestions for improvement:
1st) I would create the directory for the report path after defining the $ReportPath variable and use the $ReportPath variable to create the folder. Like this:
#Report file HTML path $htmlReportPath = "$ReportPath\VeeamBackupMicrosoft365.html"
2nd) With my community edition, I received an error message when determining the expiration date of the license. So I would check the license type first. Like this:
I like the report directory suggestions. Will keep things organized so you could run this from one location on multiple servers in other locations.
Hello :)
I totally agree for the first.
For the second, the script is for production purpose and community edition is not.
Update :
# ======================================================= # NAME: VBM365audit.ps1 # AUTHOR: Commenge Damien, Axians Cloud Builder # DATE: 11/07/2022 # # VERSION 1.03 # 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 # ======================================================= #Requires -modules Veeam.Archiver.PowerShell
#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 hSystem.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' #No way to find version with powershell but associated version with VBR is available here : https://www.veeam.com/kb4106 $VBRbuild = (Get-Module Veeam.Archiver.PowerShell).nestedmodules.version.tostring()
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"
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 }
<# .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 {
<# .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 {
<# .SYNOPSIS Get configuration about object repository configuration .DESCRIPTION Get repository name, folder, type, 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 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 {
<# .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"
<# .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 {
<# .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"
<# .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
<# .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 {
<# .SYNOPSIS Create array for HTML report .DESCRIPTION Create array with title and precontent .EXAMPLE CreateArray -title "my Title" -var $MyData -PreContent $MyPrecontent #>
Function CreateArray { param ( $Title, $Var, $PreContent )
<# .SYNOPSIS Generate HTML report .DESCRIPTION Use all variable to build html report with CSS style .EXAMPLE Get-HTMLReport -Path "C:\temp\report.html" #>
#HTML file name string] $FileName = "VBM365Audit.html" ) 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>