Editar

Partilhar via


Clear-SRMetadata

Removes unreferenced Storage Replica metadata.

Syntax

RG (Default)

Clear-SRMetadata
    [[-ComputerName] <String>]
    [-Name] <String>
    [-NoRestart]
    [-Force]
    [-Logs]
    [-Partition]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AllServer

Clear-SRMetadata
    [[-ComputerName] <String>]
    [-AllConfiguration]
    [-AllLogs]
    [-AllPartitions]
    [-NoRestart]
    [-Force]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Clear-SRMetadata cmdlet removes unreferenced Storage Replica metadata from the registry, partition, and System Volume Information folder. This orphaned metadata may exist after a failed partnership or replication group removal.

Do not run this cmdlet unless you have already tried to clean up by using the Remove-SRPartnership and Remove-SRGroup cmdlets.

Examples

Example 1: Delete all unreferenced log files

PS C:\>Clear-SRMetadata -AllLogs
Confirm
Are you sure you want to perform this action?
Clearing orphaned log files from Storage Replica log container. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y

This command deletes all unreferenced log files from all log volumes on the computer.

Example 2: Delete unreferenced log files partition database entries

PS C:\>Clear-SRMetadata -AllLogs -AllPartitions -Verbose
Confirm
Are you sure you want to perform this action?
Clearing orphaned log files from Storage Replica log container. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
VERBOSE: Looking for orphaned Storage Replica logs on volume \\?\Volume{c9406624-d9e8-489d-9f29-e95c02bc13f9}\...
VERBOSE: 1 orphaned log directories were deleted.
VERBOSE: 4 orphaned log files were deleted.
VERBOSE: Looking for orphaned records in Storage Replica partition database.
VERBOSE: No orphan records found in Storage Replica partition database.

This command deletes all unreferenced log files from all log volumes and unreferenced partition database entries from all data volumes on the computer. In this example you see that several log files were deleted.

Example 3: Clear logs for a replication group

This command gets the name of all the replication groups on the current computer by using the Format-List cmdlet. There is only one replication group on this computer.
PS C:\>Get-SRGroup | Format-List -Property "name"
Name               : ReplicationGroup01

This command clears all logs for a replication group found in the first command. The command reports verbose output.
PS C:\>Clear-SRMetadata -Name "ReplicationGroup01" -Logs -Verbose
Confirm
Are you sure you want to perform this action?
Clearing orphaned log files from Storage Replica log container. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
VERBOSE: Looking for orphaned Storage Replica logs on volume e:\...
VERBOSE: 1 orphaned log directories were deleted.
VERBOSE: 16 orphaned log files were deleted.

This example clears all logs for a specific replication group and reports verbose output.

Parameters

-AllConfiguration

Indicates that this cmdlet removes all unreferenced Storage Replica registry and cluster resource entries. This parameter does not affect unclustered hosts.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AC

Parameter sets

AllServer
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AllLogs

Indicates that this cmdlet removes all unreferenced Storage Replica logs from the hidden System Volume Information folders on all log drives.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AL

Parameter sets

AllServer
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AllPartitions

Indicates that this cmdlet removes all unreferenced Storage Replica partition databases from all data drives.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AP

Parameter sets

AllServer
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Session

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies a single replica host computer NetBIOS name or fully qualified domain name (FQDN). The default value is the local computer.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:CN

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:F

Parameter sets

(All)
Position:100
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Logs

Indicates that this cmdlet removes the unreferenced Storage Replica logs from the hidden System Volume Information folders on the log drive for the replication group specified by the Name parameter.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:LO

Parameter sets

RG
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the replication group for which this cmdlet clears data.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:N

Parameter sets

RG
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NoRestart

Indicates that the computer does not restart after the cmdlet removes the entries. By default, the computer restarts. We do not support continuing to operate the computer and its storage after metadata cleanup. Restart as soon as possible.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:NR

Parameter sets

(All)
Position:98
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Partition

Indicates that this cmdlet removes all unreferenced Storage Replica partition databases from the data drives associated with the replication group specified by Name.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:PA

Parameter sets

RG
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ThrottleLimit

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.