Partager via


Configure a Folder Item

Applies To: Windows Server 2008

Folder preference items allow you to create, update, replace, and delete folders and their contents. (To configure individual files rather than folders, see Files Extension.) Before you create a Folder preference item, you should review the behavior of each type of action possible with this extension.

Creating a Folder item

To create a new Folder preference item

  1. Open the Group Policy Management Console. Right-click the Group Policy Object (GPO) that should contain the new preference item, and then click Edit.

  2. In the console tree under Computer Configuration or User Configuration, expand the Preferences folder, and then expand the Windows Settings folder.

  3. Right-click the Folders node, point to New, and select Folder.

  4. In the New Folder Properties dialog box, select an Action for Group Policy to perform. (For more information, see "Actions" in this topic.)

  5. Enter folder settings for Group Policy to configure or remove. (For more information, see "Folder settings" in this topic.)

  6. Click the Common tab and configure any options desired. (For more information, see Configure Common Options.)

  7. Click OK. The new preference item appears in the results pane.

Actions

This type of preference item provides a choice of four actions: Create, Replace, Update, and Delete. The behavior of the preference item varies with the action selected and whether the folder already exists.

Create

Create a new folder for computers or users.

Delete

Remove a folder for computers or users.

Replace

Delete and recreate a folder for computers or users. The net result of the Replace action is to delete the contents of an existing folder and to overwrite all existing settings associated with the folder. If the folder does not exist, then the Replace action creates a new folder.

Update

Modify an existing folder for computers or users. This action differs from Replace in that it only updates settings defined within the preference item. All other settings remain as configured on the folder. If the folder does not exist, then the Update action creates a new folder.

Folder settings

Path

Type a path to the folder from the perspective of the client. Do not include quotes or a trailing slash. This field can contain variables.

Attributes

To configure file system attributes for the folder, select the appropriate check boxes.

These options are available only when the action selected is Create, Replace, or Update.

Options for Delete or Replace actions

Select a combination of options to control which files and folders are deleted. If the Replace action is selected, the folder is recreated after these options have been processed unless deletion is prevented. The effect of these options varies depending on the combination of options selected. For more information, see "Additional considerations."

These options are available only when the action selected is Replace or Delete.

Available options include:

  • Ignore errors for files/folders that cannot be deleted: If this option is cleared, an error is returned if the Folder item attempts to delete a folder that is not empty, a file that is open, a file or folder for which the user does not have permission, or any other file or folder that cannot be deleted. If selected, this option suppresses any error messages that occur because files or folders cannot be deleted.

  • Allow deletion of read-only files/folders: If this option is cleared, the Folder item is prevented from deleting read-only files and folders. If selected, this option clears the read-only attribute of files and folders that this Folder item attempts to delete.

  • Delete all files in the folder(s): If this option is cleared, the Folder item cannot delete files within folders. If selected, this option deletes all files within this folder that are allowed to be deleted. If Recursively delete all subfolders is selected as well, then all files that are allowed to be deleted within all subfolders are also deleted.

  • Recursively delete all subfolders (if emptied): If this option is cleared, the Folder item is prevented from deleting subfolders within the folder. If this option is selected, the lowest level of subfolders is deleted if they are empty, repeating for each parent folder until reaching the folder specified in the Path field. Whether subfolders are empty is evaluated after the option to Delete all files in the folder(s) has been processed.

  • Delete this folder (if emptied): If this option is cleared, the Folder item is prevented from deleting the folder specified in the Path field. If this option is selected, the folder specified in the Path field is deleted if it is empty. Whether this folder is empty is evaluated after the options to Delete all files in the folder(s) and Recursively delete all subfolders have been processed.

Additional considerations

  • Common combinations of options for Delete or Replace actions include:

    • Delete the folder only if it is empty: Select Delete this folder and Allow deletion of read-only files/folders. To prevent an error if the folder contains files and cannot be deleted, select Ignore errors.

    • Delete the folder and all files and subfolders within: Select Delete this folder, Recursively delete all subfolders, Delete all files in the folder(s), and Allow deletion of read-only files/folders.

    • Delete all empty subfolders within the folder: Select Recursively delete all subfolders and Allow deletion of read-only files/folders. To prevent an error if the folder contains files and cannot be deleted, select Ignore errors.

    • Delete all files within the folder, but not subfolders or files within subfolders: Select Delete all files in the folder(s) and Allow deletion of read-only files/folders.

    • Delete all files and subfolders within the folder: Select Recursively delete all subfolders, Delete all files in the folder(s), and Allow deletion of read-only files/folders.

  • You can use item-level targeting to change the scope of preference items.

  • Preference items are available only in domain-based GPOs.

Additional references