microsoft / Microsoft365DSC

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

Errors After Executing the Microsoft365DSC Export Command #5192

Open Reiji014 opened 4 days ago

Reiji014 commented 4 days ago

Hello. I have a question regarding the export of M365 settings values using Microsoft365DSC. The issue is that an error occurred after executing the export command of Microsoft365DSC. I would appreciate your guidance on the cause and how to resolve it.

Below is the background leading up to the error: 【Environment】 ・Devices: Two devices are in use (one device is connected via Remote Desktop) *Device A version information (connected remotely) Edition: Windows 10 Enterprise Version: 22H2 OS Build: 19045.3570 *Device B version information Edition: Windows 11 Enterprise Version: 23H2 OS Build: 22631.4169 ・Environment: M365 trial tenant ・User permissions for executing the command: Global Reader ・Application registration for Microsoft Graph and PnP.PowerShell has been completed in the Entra ID of the M365 trial tenant. The granted permissions are listed in the attached Excel file (basically only Read permissions). ・PowerShell version: 7.4.5 The installed modules are listed in the attached Excel file.

【Flow leading to the error】 ① Module installation (including Microsoft365DSC, etc.) ② Connecting to the registered Microsoft Graph and PnP PowerShell ③ Executing the export command of Microsoft365DSC *Details are provided in the attached Excel file.

【Error content】 Error Log created at {file://C:/10180-M365DSC-ErrorLog.log} Exception: The following dependencies need updating:

【Actions taken】 ・Reinstalled all modules. ・Executed the following commands to update dependencies and then re-executed the export command, but the same error occurred. ・Update-M365DSCDependencies ・Uninstall-M365DSCOutdatedDependencies ・After executing the export command, there were also instances where errors occurred that were different from the aforementioned error. Thus, I reinstalled the ExchangeOnlineManagement module and installed Microsoft.Identity.Client, but the same errors were still happening at that time. *Currently, the aforementioned error is occurring, not the errors below. Connecting to ... ❌ Partial Export file was saved at: C:\Users\XXXXXX\AppData\Local\Temp\aabf4c56-c9da-4ce3-8da4-d7887f57ded8.partial.ps1 OperationStopped: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.44.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. PS C:>

If you have any knowledge of solutions or alternatives, I would greatly appreciate your guidance. Thank you very much for your assistance. Microsoft365DSC Validation Error Status.xlsx 10180-M365DSC-ErrorLog (1).log

FabienTschanz commented 4 days ago

You have to install the Microsoft365DSC module with administrative privileges in an elevated Windows PowerShell session. It looks like the module was installed in the current user scope. Please remove the modules and install them again.