Powershell command to delete *.msu files under C:\temp and subfolder

Boopathi S 4,036 Reputation points
2026-06-27T15:05:02.3166667+00:00

Hi,

please share the powershell script to to delete *.msu files under C:\temp and its subfolder

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

Answer accepted by question author
Marcin Policht 109.4K Reputation points MVP Volunteer Moderator
2026-06-27T15:14:45.5366667+00:00
Get-ChildItem -Path "C:\Temp" -Filter "*.msu" -Recurse -File |
Remove-Item -Force -Verbose

If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

hth

Marcin

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Newest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.