maester icon indicating copy to clipboard operation
maester copied to clipboard

WIP: Import dependency modules in compatible order to avoid shared library conflicts

Open SamErde opened this issue 7 months ago • 0 comments

This pull request introduces the new Import-MtDependency PowerShell function to help avoid issues caused by conflicts in shared libraries that are used by different module dependencies.

This is a work in progress. I still need to integrate my code that makes it work on non-Windows platforms. It also needs the ability to detect what instance of each module will be imported if/when it is installed in the CurrentUser scope and AllUsers scope (or in other locations included in the PSModulePath environment variable).

New Functionality for Dependency Management:

  • powershell/internal/Import-MtDependency.ps1: Added the Import-MtDependency function to handle the loading of PowerShell modules in a compatible order by analyzing Microsoft.Identity.Client.dll versions. This function ensures modules are loaded in descending version order to prevent assembly loading conflicts. It also includes verbose logging, error handling, and a working draft for future enhancements.

Updates to Connect-Maester.ps1:

  • Dependency resolution integration: Updated Connect-Maester.ps1 to use Import-MtDependency for importing required modules based on the selected services (Graph, Azure, ExchangeOnline, Teams, etc.). This ensures proper dependency management when connecting to multiple services.
  • Syntax Highlighting: Added PowerShell syntax highlighting to an example command for improved readability in the documentation.

SamErde avatar May 21 '25 15:05 SamErde