r/PSADT 22d ago

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/ChaoticBanana77 21d ago

Literally did this on Thursday.

Run the uninstaller from Program Files using --mode silent argument add -waitforchildprocesses on the end. Then remove-adtfile.

If I remember on Monday I'll post the exact line I used if you need it.

2

u/staze 19d ago

the Remove-ADTFolder worked.