Previous
Left Arrow
Using PowerShell to check the Health and Performance of a hard drive on a Remote Server
Current Code Entry
Go Back To Code List
[PowerShell]
  • Delete contents of a folder using PowerShell

    Article Entry Date: March 19,2026 @ 09:27:10 / Last Updated On: March 19,2026 @ 09:27:10
Sometimes you need to delete contents from a folder or multiple folders. In this article, we will do just that.
We will delete the contents of 4 folders.

You will first need to allow PowerShell to run scripts.

Next, copy and save this as Remove.ps1


Several options for running this.
  1. Right-click and choose [run with PowerShell]
  2. Run with [PowerShell ISE]
    Right-click the file and choose [Properties]
    Click the [Change..] button
    Scroll down and choose [Look for another app on this PC]
    Paste this in
    %windir%\system32\WindowsPowerShell\v1.0
    Click [Enter]. Select [powershell_ise.exe ]and click [Open] (This is the PS Editor. Great for design and editing your Scripts)
    Click [Apply] and [OK]
    When you double click the file it will open the [ISE].