Skip to content

Commit

Permalink
Health Check - Validate VB365 server is not joined to production Acti…
Browse files Browse the repository at this point in the history
…ve Directory domain. AsBuiltReport#27
  • Loading branch information
rebelinux committed May 24, 2024
1 parent 2c9b153 commit c41eb73
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
19 changes: 17 additions & 2 deletions Src/Private/Get-AbrVb365Proxy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,23 @@ function Get-AbrVB365Proxy {

process {
try {
$domainJoined = (Get-CimInstance -Class Win32_ComputerSystem -CimSession $TempCIMSession).partofdomain
$script:Proxies = Get-VBOProxy -WarningAction SilentlyContinue | Sort-Object -Property Hostname
if (($InfoLevel.Infrastructure.Proxy -gt 0) -and ($Proxies)) {
Write-PScriboMessage "Collecting Veeam VB365 Proxy information."
Section -Style Heading2 'Backup Proxies' {
$ProxyInfo = @()
foreach ($Proxy in $Proxies) {
Try {
Write-PScriboMessage "Connecting to VB365 server '$Proxy.Hostname' through CIM session."
$TempCIMSession = New-CimSession $Proxy.Hostname -Credential $Credential -Authentication 'Negotiate' -ErrorAction Continue -Name "Global:TempCIMSession"
} Catch {
Write-PScriboMessage -IsWarning "Unable to connect to VB365 server '$System' through CIM session. Continuing"
}
if ($TempCIMSession) {
$domainJoined = (Get-CimInstance -Class Win32_ComputerSystem -CimSession $TempCIMSession).partofdomain
} else {
$domainJoined = 'Unknown'
}
$inObj = [ordered] @{
'Name' = $Proxy.Hostname
'Port' = $Proxy.Port
Expand All @@ -41,9 +51,14 @@ function Get-AbrVB365Proxy {
'Is Teams Graph API Backup Enabled' = ConvertTo-TextYN $Proxy.IsTeamsGraphAPIBackupEnabled
'Is Domain Joined' = ConvertTo-TextYN $domainJoined
'Description' = $Proxy.Description

}
$ProxyInfo += [PSCustomObject]$InObj

if ($TempCIMSession) {
# Remove used CIMSession
Write-PScriboMessage "Clearing CIM Session $($TempCIMSession.Id)"
Remove-CimSession -CimSession $TempCIMSession
}
}

if ($HealthCheck.Infrastructure.Proxy) {
Expand Down
11 changes: 0 additions & 11 deletions Src/Public/Invoke-AsBuiltReport.Veeam.VB365.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ function Invoke-AsBuiltReport.Veeam.VB365 {
Get-AbrVB365ServerConnection

$VeeamBackupServer = ((Get-VBOServerComponents -Name Server).ServerName).ToString().ToUpper().Split(".")[0]
Try {
Write-PScriboMessage "Connecting to VB365 server '$System' through CIM session."
$script:TempCIMSession = New-CimSession $System -Credential $Credential -Authentication 'Negotiate' -ErrorAction Continue -Name "Global:TempCIMSession"
} Catch {
Write-PScriboMessage -IsWarning "Unable to connect to VB365 server '$System' through CIM session. Continuing"
}

Section -Style Heading1 $($VeeamBackupServer) {
Paragraph "The following section provides an overview of the implemented components of Veeam Backup for Microsoft 365."
Expand Down Expand Up @@ -163,11 +157,6 @@ function Invoke-AsBuiltReport.Veeam.VB365 {
}
}
}
if ($TempCIMSession) {
# Remove used CIMSession
Write-PScriboMessage "Clearing CIM Session $($TempCIMSession.Id)"
Remove-CimSession -CimSession $TempCIMSession
}
}
}
#endregion foreach loop
Expand Down

0 comments on commit c41eb73

Please sign in to comment.