...
Run the following commands to define the name names of the PowerShell module or collection and the names of any dependent modules in modules that are a dependency for other modules the collection:
Code Block |
---|
|
$PowerShellModuleName = 'Microsoft.Graph'
$DependentModuleNames$DependsOnModuleNames = 'Microsoft.Graph.Authentication' |
Run the following commands to define split the Graph PowerShell modules respecting the dependency on the Microsoft.Graph.Authentication modulemodule collection based upon any dependencies:
Code Block |
---|
|
$Modules, $DependentModules$DependencyModules = (Get-Module -Name "$PowerShellModuleName.*").Where({$_.Name -notin $DependentModuleNames$DependsOnModuleNames},[System.Management.Automation.WhereOperatorSelectionMode]::Split) |
Run the following commands to unload the Graph PowerShell modules respecting the dependency on the Microsoft.Graph.Authentication moduleany dependencies:
Code Block |
---|
|
$Modules | ForEach-Object { Remove-Module -Name $_.Name -Force }; $DependentModules$DependencyModules | ForEach-Object { Remove-Module -Name $_.Name -Force } |
...