@@ -241,32 +241,38 @@ function Invoke-JobOrganizationInformation {
241241 Invoke-CatchActions
242242 }
243243
244- $schemaRangeUpper = (
245- ($adSchemaInformation.msExchSchemaVersionPt.Properties [" RangeUpper" ])[0 ]).ToInt32([System.Globalization.NumberFormatInfo ]::InvariantInfo)
244+ $CVE202221978Results = $null
245+ $CVE202134470Results = $null
246+ # Only execute if we were able to return the information from the schema class.
247+ if ($null -ne $adSchemaInformation.msExchSchemaVersionPt ) {
246248
247- if ($schemaRangeUpper -lt 15323 ) {
248- $schemaLevel = " 2013"
249- } elseif ($schemaRangeUpper -lt 17000 ) {
250- $schemaLevel = " 2016"
251- } else {
252- $schemaLevel = " 2019"
253- }
249+ $schemaRangeUpper = (
250+ ($adSchemaInformation.msExchSchemaVersionPt.Properties [" RangeUpper" ])[0 ]).ToInt32([System.Globalization.NumberFormatInfo ]::InvariantInfo)
254251
255- $cve21978Params = @ {
256- DomainsAcls = $domainsAclPermissions
257- ExchangeWellKnownSecurityGroups = $wellKnownSecurityGroups
258- ExchangeSchemaLevel = $schemaLevel
259- SplitADPermissions = $isSplitADPermissions
260- }
252+ if ($schemaRangeUpper -lt 15323 ) {
253+ $schemaLevel = " 2013"
254+ } elseif ($schemaRangeUpper -lt 17000 ) {
255+ $schemaLevel = " 2016"
256+ } else {
257+ $schemaLevel = " 2019"
258+ }
261259
262- $cve34470Params = @ {
263- MsExchStorageGroup = $adSchemaInformation.MsExchStorageGroup
260+ $cve21978Params = @ {
261+ DomainsAcls = $domainsAclPermissions
262+ ExchangeWellKnownSecurityGroups = $wellKnownSecurityGroups
263+ ExchangeSchemaLevel = $schemaLevel
264+ SplitADPermissions = $isSplitADPermissions
265+ }
266+ Get-SecurityCve - 2022 - 21978 @cve21978Params | Invoke-RemotePipelineHandler - Result ([ref ]$CVE202221978Results )
264267 }
265268
266- $CVE202221978Results = $null
267- $CVE202134470Results = $null
268- Get-SecurityCve - 2022 - 21978 @cve21978Params | Invoke-RemotePipelineHandler - Result ([ref ]$CVE202221978Results )
269- Get-SecurityCve - 2021 - 34470 @cve34470Params | Invoke-RemotePipelineHandler - Result ([ref ]$CVE202134470Results )
269+ if ($null -ne $adSchemaInformation.MsExchStorageGroup ) {
270+ $cve34470Params = @ {
271+ MsExchStorageGroup = $adSchemaInformation.MsExchStorageGroup
272+ }
273+
274+ Get-SecurityCve - 2021 - 34470 @cve34470Params | Invoke-RemotePipelineHandler - Result ([ref ]$CVE202134470Results )
275+ }
270276
271277 $securityResults = [PSCustomObject ]@ {
272278 CVE202221978 = $CVE202221978Results
0 commit comments