I was able to remove and set the environment for a project/folder structure with the exception of folders that had files. Is it possible to force this?
Not that I am aware of. New cmdlets are needed that would get, set and remove a sheet. You could then loop through all documents that had a sheet in the folder and remove them. You would lose all the attribute data also. Once no files in the folder have a sheet assigned you could change the environment.
Thinking outside the box with current cmdlets you could export all the files out of PW, delete them from PW, change the environment and then re-import. It gets the job done but could cause new issues depending on the file (e.g. issues caused by a GUID change, scan ref issues)
I think I will avoid export and re-importing. The scan ref issues area bit too huge. Would it be possible to move the files to a temporary structure (similar), change the environment, and then move back?
Probably - Check out Move-PWDocumentsToFolder. Not sure how moving and then moving back affects references though.
Based on manual moves I have done, it shouldn't affect the sheet files.