diff --git a/d365fo.tools/functions/invoke-d365sdpinstallude.ps1 b/d365fo.tools/functions/invoke-d365sdpinstallude.ps1 index 8417052f..5d57553f 100644 --- a/d365fo.tools/functions/invoke-d365sdpinstallude.ps1 +++ b/d365fo.tools/functions/invoke-d365sdpinstallude.ps1 @@ -103,6 +103,13 @@ function Invoke-D365SDPInstallUDE { return } + # Delete existing module folder if it exists + $moduleFolderPath = Join-Path -Path $MetaDataDir -ChildPath $($_.Name) + if (Test-Path -Path $moduleFolderPath) { + Remove-Item -Path $moduleFolderPath -Recurse -Force + Write-PSFMessage -Level Verbose -Message "Deleted existing module folder $moduleFolderPath" + } + # Unzip to $MetaDataDir $moduleZipPath = Join-Path -Path $MetaDataDir -ChildPath $($_.Name) Expand-Archive -Path $moduleZip.FullName -DestinationPath $moduleZipPath @@ -114,4 +121,4 @@ function Invoke-D365SDPInstallUDE { Invoke-TimeSignal -End -} \ No newline at end of file +}