microsoft / Microsoft365DSC

Manages, configures, extracts and monitors Microsoft 365 tenant configurations
https://aka.ms/M365DSC
MIT License
1.48k stars 448 forks source link

Intune export issue with multiple components #4537

Open AWeber78 opened 3 months ago

AWeber78 commented 3 months ago

Description of the issue

image

Microsoft 365 DSC Version

1.24.403.1

Which workloads are affected

Intune

The DSC configuration

Export-M365DSCConfiguration -Components @("IntuneDeviceEnrollmentStatusPageWindows10" , "IntuneWindowsAutopilotDeploymentProfileAzureADJoined") -Path $path -Filename $Filename -Validate -Credential $Credential

Verbose logs showing the problem

[2024.04.08 10:10:29]
{InvalidOperation}
System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at Get-M365DSCExportContentForResource(Closure, FunctionContext)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.CommandProcessorBase.Complete()
"Error during Export:"
at Get-M365DSCExportContentForResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCUtil.psm1: line 3405
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\DSCResources\MSFT_IntuneDeviceEnrollmentStatusPageWindows10\MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1: line 748
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCReverse.psm1: line 649
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCUtil.psm1: line 1369
at <ScriptBlock>, <No file>: line 1
XXXn@XXX.org
TenantId: XXXX

Environment Information + PowerShell Version

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : de-DE
OsMuiLanguages       : {de-DE, en-US}

PS C:\Users\anweber>
PS C:\Users\anweber> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.22635
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
AWeber78 commented 3 months ago

Works with PowerShell 5 but not with PowerShell 7