Deleting Folders By Group Policy Preference

DarthRater
DarthRater used Ask the Experts™
on
I have been charged with locking down an envirnoment and the first steps is to delete all data in a users Desktop and Documents. I have created a GPP that works great with XP,

User Configuration>Preferences>Windows Settings>Folders

Delete %USERPROFILE%\Desktop\ and %USERPROFILE%/My Documents. The GPP correctly nukes all folders.

MY issue is with Win 7. The Desktop Variable works fine, but the %USERPROFILE%\Documents fails with an event log error.

The user 'Win7 Documents' preference item in the 'Restriction: Delete Contents of Desk/Docs {8EF922B8-1AF0-44BB-9305-E375F0485DD8}' Group Policy object did not apply because it failed with error code '0x80070091 The directory is not empty.'

I have all the options checked so it shouldn't matter if the destination is empty. On XP it kills everything in the target folder.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Did you specify the other Delete options in your delete preference?

Commented:
There may be an issue with the drive. Try CHKDSK /F in the Start Search box and press Enter.
 
Note: If the folder you are trying to delete is located on a drive that is not your C: drive, add the drive letter to the end of the command. Example: CHKDSK /F E:

If you get an error after running, reboot and to let the scan run. Try to delete again.

HTH

Author

Commented:
@motnahp00

"I have all the options checked so it shouldn't matter if the destination is empty. On XP it kills everything in the target folder."

@wbsn
No. That is not part of the problem.
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Here's another suggestion.

User logon script:

robocopy C:\emptyfolder %USERPROFILE%\Desktop /MIR /R:0
robocopy C:\emptyfolder %USERPROFILE%/My Documents /MIR /R:0

Author

Commented:
Interesting. I'll give that a shot and report back, thank you.
Trying to think outside the box. I'm still wondering why your GPO didn't work.

Author

Commented:
Yea me too, considering it works very well on XP.
Maybe this will help. I'm headed to sleep in a bit. I'll follow up with you tomorrow morning.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial