I demoted a former Windows OS drive to a data drive recently without formatting it. The SSD still contained my OneDrive folder, and I did not want to download it again or copy it from a backup. Therefore, all of the Windows system folders were still on the drive. I tried to delete them, but whatever I did using the GUI, Windows slapped my fingers. I was not able to remove the Program Files and Windows folder.
There is a solution using the command line, though. You must execute all commands in an Administrator command prompt.
Example for the Program Files directory.
takeown /f "Z:\Program Files" /a /r /d Y
icacls "Z:\Program Files" /t /grant administrators:F
rd /s /q "Z:\Program Files"
Gotcha: I have noticed that I had to execute the statements a second time on some folders to delete them finally.
An exception is the Windows directory. It cannot be removed using these commands. I have found another workaround that tricks Windows into believing it is a previous Windows installation. Rename the Windows directory to “Windows.old” and then run Disk Cleanup -> Clean up system files. Windows will detect this as an old installation and offer to remove it.
Documentation