編輯

共用方式為


Backup-ACL

Backs up the security descriptor of an item.

Syntax

Backup-ACL
      [-Path] <String>
      [-DestinationPath] <String>
      [-LogPath] <String>
      [[-ScheduleTrigger] <Object>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Backup-Acl cmdlet backs up the security descriptor of a specified item, such as a file or a registry key.

To back up an ACL, specify the Path parameter to identify the item. Use the DestinationPath parameter to specify the location for the backup.

Examples

Example 1: Back up the ACL for a file

Backup-ACL -Path "C:\file01.txt" -DestinationPath "C:\AclBackups\file01.xml" -LogPath "C:\AclBackupLogs\"

This command backs up the ACL for the specified file. The command also specifies the location for the backup and the log.

Example 2: Back up on a schedule

$TaskTrigger = New-ScheduledTaskTrigger -Daily -At 6am
Backup-ACL -Path "C:\file02.txt" -DestinationPath "C:\AclBackups\" -LogPath "C:\AclBackups\" -ScheduleTrigger $TaskTrigger

This example backs up the ACL on a regular schedule.

The first command creates a scheduled task trigger by using the New-ScheduledTaskTrigger cmdlet and stores it in the $TaskTrigger variable.

The second command backs up the ACL according to the schedule object, in this case, daily at 6:00 AM.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DestinationPath

Specifies a full path to store the permission backup.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-LogPath

Specifies a full path for the log file.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Path

Specifies the full path of the object for which the cmdlet backs up permissions.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ScheduleTrigger

Specifies a ScheduleTrigger object. A trigger creates pipeline runs periodically, on schedule.

Type:Object
Position:3
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Object

Outputs

Object