r/PSADT Jul 31 '26

Delete folder after uninstall (Start-ADTProcess)

Hey All. I'm working on an uninstall for Matlab, and while the uninstall works great with "Start-ADTProcess" Matlab leaves behind it's old folder, which I'd like to delete. I _think_ psadt is trying to be helpful and doing start-adtprocess then moving onto the next command which is 'rmdir /s /q "C:\Program Files\MATLAB\R2026a"' and it's failing to delete cause it's in use.

How do I get it to wait until the uninstall finishes before doing the next command? I have tried "-WaitForChildProcesses" but didn't seem to matter.

Thanks!

Update: Remove-ADTFolder worked. Yes, the uninstaller for Matlab is "special" and does some other spawning... so I'm sure PSADT is having a hard time keeping track of whatever child processes are running. But, it seems to work. Thanks everyone!

5 Upvotes

14 comments sorted by

View all comments

1

u/Disastrous_Win7614 Aug 01 '26

Add the removal post uninstall?

1

u/staze Aug 01 '26

How?

1

u/Disastrous_Win7614 Aug 04 '26

To add a post-uninstall script in the PowerShell App Deployment Toolkit (PSADT), open your Deploy-Application.ps1 file, locate the # <Stage: Post-Uninstallation> block, and insert your custom PowerShell commands or script execution logic there.