Add-WBFileSpec

Windows Server 2012 R2 and Windows 8.1

Add-WBFileSpec

Adds a backup file specification to a backup policy.

구문

Parameter Set: Default
Add-WBFileSpec [-Policy] <WBPolicy> [-FileSpec] <WBFileSpec[]> [ <CommonParameters>]




자세한 설명

The Add-WBFileSpec cmdlet adds a backup file specification, which specifies the items to include in or exclude from a backup, to a backup policy. A WBFileSpec object contains the backup file specification, and a WBPolicy object contains the backup policy. The WBFileSpec object can include or exclude multiple files, folders, or volumes. You can create a list of items to include or exclude by using the New-WBFileSpec cmdlet and then using the Add-WBFileSpec cmdlet to update the WBPolicy object.

Before you can add a backup file specification to a WBPolicy object, you must put the WBPolicy object in edit mode. To put the WBPolicy object in edit mode for a policy that you set as the scheduled backup policy, use the Get-WBPolicy cmdlet with the Editable parameter. The New-WBPolicy cmdlet creates a new WBPolicy object that is already in edit mode.

To use this cmdlet, you must be a member of the Administrators group or Backup Operators group.

매개 변수

-FileSpec<WBFileSpec[]>

Specifies an array of WBFileSpec objects that contain backup file specifications to add to the WBPolicy object.


별칭

없음

필수 여부

true

위치

2

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

-Policy<WBPolicy>

Specifies a WBPolicy object that contains the backup policy to update.


별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(http://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • WBFileSpec [], WBPolicy

    The Add-WBFileSpec cmdlet adds a list of items from a WBFileSpec object that contains a backup file specification to a WBPolicy object that contains a backup policy.


출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • None

    None


예제

Example 1: Add backup file specifications to a backup policy

This example adds three backup file specifications to the WBPolicy object in the variable named $Policy.

The first command assigns the file named C:\sample\1.jpg to the variable named $Filespec1.

The second command assigns the files that match the wildcard specification C:\Sample\*.txt (text files in the C:\Sample directory) to the variable named $Filespec2.

The third command assigns the files that match the wildcard specification C:\Sample\*.mp3 txt (MP3 files in the C:\Sample directory) to the variable named $Filespec3. Because this command includes the Exclude parameter, the backup from this policy excludes MP3 files in C:\Sample.

The fourth command adds the file specifications in $Filespec1, $Filespec2, and $Filespec3 to the backup policy in the variable named $Policy.


PS C:\> $Filespec1 = New-WBFileSpec -FileSpec C:\Sample\1.jpg
PS C:\> $Filespec2 = New-WBFileSpec -FileSpec C:\Sample\*.txt
PS C:\> $Filespec3 = New-WBFileSpec -FileSpec C:\Sample\*.mp3 -Exclude
PS C:\> Add-WBFileSpec -Policy $Policy $Filespec1,$Filespec2,$Filespec3

Example 2: Add an array of backup file specifications to a backup policy

This example adds an array of backup file specifications to a backup policy.

The first command assigns the file specifications in the variables named $Filespec1, $Filespec2, and $Filespec3 to the array in the variable named $Filespecarray.

The second command adds the array of file specifications in $Filespecarray to the WBPolicy object in the variable named $Policy.


PS C:\> $Filespecarray = ($Filespec1, $Filespec2, $Filespec3) 
PS C:\> Add-WBFileSpec -Policy $Policy $Filespecarray

관련 항목

커뮤니티 추가 항목

추가
표시: