Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

Uninstall-M365DSCOutdatedDependencies : Could not uninstall {ReverseDSC}

Open bubbletroubles opened this issue 1 year ago • 2 comments

Description of the issue

Using M365DSC release 1.25.611.1, the pipeline ran successfully 12 hours ago. In the last 12 hours, the M365DSC release 1.25.702.1 was made available. Now it doesn't matter which release version I use, when I run Update-M365DSCModule, I get the error that ReverseDSC could not be uninstalled.

I have a Azure DevOps pipeline which installs the following modules and versions:

    'M365DSC.CompositeResources' = 'latestMatchingMicrosoft365DSC'
    'M365DSCTools'               = 'latest'
    'Microsoft365DSC'            = '1.25.702.1'
    'Pester'                     = 'latest'
    'ObjectGraphTools'           = 'latest'
    'DscBuildHelpers'            = 'latest'

I then run Update-M365DSCModule and it gives the error Uninstall-M365DSCOutdatedDependencies : Could not uninstall {ReverseDSC}

Microsoft 365 DSC Version

1.25.702.1 and 1.25.611.1

Which workloads are affected

other

The DSC configuration


Verbose logs showing the problem

2025-07-04 23:16:32 [INFO] DeployModules.ps1: Running Update-M365DSCModule to install all dependencies...
Installing Az.Accounts version {3.0.2}
Installing Az.Resources version {7.2.0}
Installing DSCParser version {2.0.0.17}
Installing ExchangeOnlineManagement version {3.8.0}
WARNING: The version '1.4.8.1' of module 'PackageManagement' is currently in use. Retry the operation after closing the
 applications.
Installing Microsoft.Graph.Beta.Applications version {2.28.0}
Installing Microsoft.Graph.Beta.DeviceManagement version {2.28.0}
Installing Microsoft.Graph.Beta.Devices.CorporateManagement version {2.28.0}
Installing Microsoft.Graph.Beta.DeviceManagement.Administration version {2.28.0}
Installing Microsoft.Graph.Beta.DeviceManagement.Enrollment version {2.28.0}
Installing Microsoft.Graph.Beta.NetworkAccess version {2.28.0}
Installing Microsoft.Graph.Beta.Identity.DirectoryManagement version {2.28.0}
Installing Microsoft.Graph.Beta.Identity.Governance version {2.28.0}
Installing Microsoft.Graph.Beta.Identity.SignIns version {2.28.0}
Installing Microsoft.Graph.Beta.Reports version {2.28.0}
Installing Microsoft.Graph.Beta.Search version {2.28.0}
Installing Microsoft.Graph.Beta.Teams version {2.28.0}
Installing Microsoft.Graph.Beta.DirectoryObjects version {2.28.0}
Installing Microsoft.Graph.Beta.Groups version {2.28.0}
Installing MicrosoftTeams version {7.0.0}
Installing MSCloudLoginAssistant version {1.1.48}
Installing PnP.PowerShell version {1.12.0}
Installing ReverseDSC version {2.0.0.28}
Uninstalling Az.Accounts Version {5.1.0}
Uninstalling Az.Accounts Version {5.1.1}
Uninstalling Az.Resources Version {7.5.0}
Checking Microsoft.Graph.Authentication
##[error]Uninstall-M365DSCOutdatedDependencies : Could not uninstall {ReverseDSC}
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.702.1\Modules\M365DSCUtil.psm1:4798 char:9
+         Uninstall-M365DSCOutdatedDependencies
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Uninstall-M365DSCOutdatedDependencies

Environment Information + PowerShell Version

2025-07-04T23:31:33.0423075Z ##[section]Starting: Display System Information
2025-07-04T23:31:33.0430980Z ==============================================================================
2025-07-04T23:31:33.0431136Z Task         : PowerShell
2025-07-04T23:31:33.0431206Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2025-07-04T23:31:33.0431322Z Version      : 2.247.1
2025-07-04T23:31:33.0431393Z Author       : Microsoft Corporation
2025-07-04T23:31:33.0431492Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2025-07-04T23:31:33.0431607Z ==============================================================================
2025-07-04T23:31:34.5969067Z Generating script.
2025-07-04T23:31:34.6771396Z ========================== Starting Command Output ===========================
2025-07-04T23:31:34.7184175Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\98f6d5f5-92c6-486b-8a08-53a01007f1b2.ps1'"
2025-07-04T23:31:35.1565448Z =========================================================
2025-07-04T23:31:35.1576030Z System Information
2025-07-04T23:31:35.1586309Z =========================================================
2025-07-04T23:31:35.1591390Z 
2025-07-04T23:31:35.1600613Z Computer Information:
2025-07-04T23:31:35.1610344Z --------------------
2025-07-04T23:31:38.2054204Z 
2025-07-04T23:31:38.2055187Z 
2025-07-04T23:31:38.2064621Z OsName               : Microsoft Windows Server 2022 Datacenter
2025-07-04T23:31:38.2066515Z OsOperatingSystemSKU : DatacenterServerEdition
2025-07-04T23:31:38.2067447Z OsArchitecture       : 64-bit
2025-07-04T23:31:38.2068334Z WindowsVersion       : 2009
2025-07-04T23:31:38.2069572Z WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
2025-07-04T23:31:38.2071292Z OsLanguage           : en-US
2025-07-04T23:31:38.2073645Z OsMuiLanguages       : {en-US}
2025-07-04T23:31:38.2083519Z 
2025-07-04T23:31:38.2084238Z 
2025-07-04T23:31:38.2084711Z 
2025-07-04T23:31:38.2089180Z 
2025-07-04T23:31:38.2093440Z PowerShell Version Information:
2025-07-04T23:31:38.2100681Z ------------------------------
2025-07-04T23:31:38.2111960Z 
2025-07-04T23:31:38.2112688Z 
2025-07-04T23:31:38.2118097Z Name  : PSVersion
2025-07-04T23:31:38.2118954Z Value : 5.1.20348.2849
2025-07-04T23:31:38.2119389Z 
2025-07-04T23:31:38.2124547Z Name  : PSEdition
2025-07-04T23:31:38.2125297Z Value : Desktop
2025-07-04T23:31:38.2125594Z 
2025-07-04T23:31:38.2132414Z Name  : PSCompatibleVersions
2025-07-04T23:31:38.2134306Z Value : {1.0, 2.0, 3.0, 4.0...}
2025-07-04T23:31:38.2134912Z 
2025-07-04T23:31:38.2140446Z Name  : BuildVersion
2025-07-04T23:31:38.2141360Z Value : 10.0.20348.2849
2025-07-04T23:31:38.2141624Z 
2025-07-04T23:31:38.2146500Z Name  : CLRVersion
2025-07-04T23:31:38.2147280Z Value : 4.0.30319.42000
2025-07-04T23:31:38.2147545Z 
2025-07-04T23:31:38.2151917Z Name  : WSManStackVersion
2025-07-04T23:31:38.2152754Z Value : 3.0
2025-07-04T23:31:38.2153076Z 
2025-07-04T23:31:38.2160231Z Name  : PSRemotingProtocolVersion
2025-07-04T23:31:38.2161009Z Value : 2.3
2025-07-04T23:31:38.2161260Z 
2025-07-04T23:31:38.2165773Z Name  : SerializationVersion
2025-07-04T23:31:38.2166847Z Value : 1.1.0.1
2025-07-04T23:31:38.2168090Z 
2025-07-04T23:31:38.2169606Z 
2025-07-04T23:31:38.2170114Z 
2025-07-04T23:31:38.2176634Z 
2025-07-04T23:31:38.2195205Z =========================================================
2025-07-04T23:31:38.2838679Z ##[section]Finishing: Display System Information

bubbletroubles avatar Jul 04 '25 23:07 bubbletroubles

Same issue here - any idea why @FabienTschanz ?

The only line I can see that has changed is: https://github.com/microsoft/Microsoft365DSC/blame/776640137dd70d65e70c0f894dcb563876e02096/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1#L3467C39-L3467C58

(NB Also Uninstall-M365DSCOutdatedDependencies still seems to be removing newer versions of the modules - a later version of Az.Accounts got removed when I ran it. Can we do a '-lt' check instead of '-ne' in the relevant place?)

Borgquite avatar Jul 07 '25 13:07 Borgquite

The M365dscutil.psm1 is missing either these rules around 3519 :
$currentPath = Join-Path -Path $PSScriptRoot -ChildPath '..' -Resolve $manifest = Import-PowerShellDataFile "$currentPath\Dependencies\Manifest.psd1"

or the $manifest.Dependencies needs to be also changed to : $Script:M365DSCDependencies

Currently it has no input for the authentication part of the uninstall function and that just errors with the previous values which is reverseDSC

JIO-CIPP avatar Jul 08 '25 05:07 JIO-CIPP