Skip to content

Commit

Permalink
Fix Invoke-D365SDPInstallUDE to handle updates and require admin priv…
Browse files Browse the repository at this point in the history
…ileges

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).
  • Loading branch information
FH-Inway committed Jan 28, 2025
1 parent b0d5f2f commit 293c365
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion d365fo.tools/functions/invoke-d365sdpinstallude.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -114,4 +121,4 @@ function Invoke-D365SDPInstallUDE {

Invoke-TimeSignal -End

}
}

0 comments on commit 293c365

Please sign in to comment.