Skip to content

Commit 5c982d3

Browse files
committed
Fix Invoke-D365SDPInstallUDE to handle updates and require admin privileges
Add logic to delete existing module folders before extracting new ones in `invoke-d365sdpinstallude.ps1`. * Delete existing module folder if it exists before unzipping the new module. * Add verbose message to indicate deletion of existing module folder. * Adjust indentation and add missing newline at the end of the file. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/fh-inway/d365fo.tools?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent b0d5f2f commit 5c982d3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

d365fo.tools/functions/invoke-d365sdpinstallude.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ function Invoke-D365SDPInstallUDE {
103103
return
104104
}
105105

106+
# Delete existing module folder if it exists
107+
$moduleFolderPath = Join-Path -Path $MetaDataDir -ChildPath $($_.Name)
108+
if (Test-Path -Path $moduleFolderPath) {
109+
Remove-Item -Path $moduleFolderPath -Recurse -Force
110+
Write-PSFMessage -Level Verbose -Message "Deleted existing module folder $moduleFolderPath"
111+
}
112+
106113
# Unzip to $MetaDataDir
107114
$moduleZipPath = Join-Path -Path $MetaDataDir -ChildPath $($_.Name)
108115
Expand-Archive -Path $moduleZip.FullName -DestinationPath $moduleZipPath
@@ -114,4 +121,4 @@ function Invoke-D365SDPInstallUDE {
114121

115122
Invoke-TimeSignal -End
116123

117-
}
124+
}

0 commit comments

Comments
 (0)