共用方式為


Configure a File Item

Applies To: Windows 8, Windows Server 2008 R2, Windows Server 2012

File preference items allow you to copy, modify the attributes of, replace, and delete files. (To configure folders rather than individual files, see Folders Extension.) Before you create a File preference item, you should review the behavior of each type of action possible with this extension.

Creating a File item

To create a new File 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 Files node, point to New , and select File .

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

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

  6. Click the Common tab, configure any options, and then type your comments in the Description box. (For more information, see Configure Common Options.)

  7. Click OK . The new preference item appears in the details 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 file already exists.

Create

Copy a file (or multiple files in one folder) from a source location to a destination location if it does not already exist at the destination, and then configure the attributes of those files for computers or users.

Delete

Remove a file (or multiple files in one folder) for computers or users.

Replace

Delete a file (or multiple files in one folder), replace it with another file or files, and configure the attributes of those files for computers or users. The net result of the Replace action is to overwrite the files at the destination location. If the file does not exist at the destination, then the Replace action copies the file from the source location to the destination.

Update

Modify settings of an existing file (or multiple files in one folder) for computers or users. This action differs from Replace in that it only updates file attributes defined within the preference item. All other file attributes remain as configured on the file. If the file does not exist, then the Update action copies the file from the source location to the destination.

File settings

Source file(s)

Type the location from which to copy the Source file(s) . This location can be a fully qualified UNC path or a path on a local or mapped drive from the perspective of the client. This field can contain variables.

This field can also contain single character (?) and multiple character (*) wildcards, allowing you to copy or modify multiple files.

This option is available only if the action selected is Create , Replace , or Update .

Destination file

Type the location to which to copy a file or the location of the file to be modified. This location can be a fully qualified UNC path or a path on a local or mapped drive from the perspective of the client. Parent folders are created as necessary. You must include the file name, and you can change the file name by providing a different name for it than specified in the Source file(s) field.

This option is available only if the action selected is Create , Replace , or Update and the Source files(s) does not include wildcards.

Destination folder

Type the location of the folder to which to copy files or the location of the files to be modified. This location can be a fully qualified UNC path or a path on a local or mapped drive from the perspective of the client. Parent folders are created as necessary.

This option is available only if the action selected is Create , Replace , or Update and the Source files(s) includes wildcards.

Delete file(s)

To delete a file, type the path for the file from the perspective of the client.

To delete multiple files within a folder, incorporate single character (?) and multiple character (*) wildcards in the file name.

This option is available only if the action selected is Delete .

Suppress errors on individual file actions

To allow multiple files to transfer even if one or more individual files fail to transfer, select this check box. Only errors due to an attempt to replace, delete, or configure attributes of a file are suppressed. Such errors may be due to the file being in use, access being denied, or the source file not being found. With this option selected, such errors can only be detected in the trace file. This option is distinct from the default preference error suppression that can be overridden on the Common tab.

Attributes

To configure file system attributes for the files being transferred, select the appropriate check boxes in the Attributes box. Unchecked attributes are removed from the file at the destination.

Additional considerations

  • Many incremental backup systems use the Archive attribute to determine whether a file or folder has been created or changed and to back up the file or folder. For this reason, Archive is selected by default to select the Archive attribute on any modified folder.

  • If the Common tab option to Remove this item when it is no longer applied is selected, the destination file is deleted if it is a single file. In a multiple file operation, no files are deleted.

  • By default, a file preference item has access to all objects with the SYSTEM Access Control Entry (ACE). To change this item to run with end-user permissions (if under User Configuration ), change the security context on the Common tab.

  • A file preference item resets the Read Only attribute of any destination file if necessary to accomplish the specified task.

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

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

Additional references