Storage Cmdlets in Windows PowerShell

Windows PowerShell® 是工作型命令列殼層和指令碼語言,專為系統管理所設計。本參考主題適用於資訊技術 (IT) 專業人員,提供利用 Windows PowerShell Cmdlet 以執行指令碼和自動化工作的協助。

Windows Storage Management

This reference provides cmdlet descriptions and syntax for all Windows Storage Management-specific cmdlets. It lists the cmdlets in alphabetical order based on the verb at the beginning of the cmdlet.

cmdlet Description

Add-InitiatorIdToMaskingSet

Adds an initiator identifier (ID) to an existing masking set.

Add-PartitionAccessPath

Adds an access path such as a drive letter or folder to a partition.

Add-PhysicalDisk

Adds a physical disk to a storage pool for the creation of one or more VirtualDisk objects.

Add-TargetPortToMaskingSet

Adds a target port to a specified masking set, allowing a connection between the target port, and any virtual disk and initiator IDs that the masking set contains.

Add-VirtualDiskToMaskingSet

Adds a virtual disk to a specified masking set and grants access to the virtual disk from all initiator IDs defined in the masking set.

Clear-Disk

Cleans a disk by removing all partition information and un-initializing it, erasing all data on the disk.

Clear-FileStorageTier

Removes a file from a storage tier.

Connect-VirtualDisk

Connects a disconnected virtual disk to the specified computer when using the Storage Spaces subsystem.

Disable-PhysicalDiskIndication

Turns off the identification LED on the specified PhysicalDisk object.

Disable-StorageEnclosureIdentification

Turns off identification LED on a storage enclosure or the slots for individual disks.

Disconnect-VirtualDisk

Disconnects a virtual disk from the specified computer, revoking access to the virtual disk.

Dismount-DiskImage

Dismounts a disk image (virtual hard disk or ISO) so that it can no longer be accessed as a disk.

Enable-PhysicalDiskIndication

Enables an LED on the specified physical disk object, typically used for visual identification of the location of a physical disk in an enclosure for removal and replacement operations.

Enable-StorageEnclosureIdentification

Enables identification LED on a storage enclosure or the slots for individual disks.

Format-Volume

Formats one or more existing volumes or a new volume on an existing partition.

Get-Disk

Gets one or more disks visible to the operating system.

Get-DiskImage

Gets one or more disk image objects (virtual hard disk or ISO).

Get-FileIntegrity

Gets integrity information for a file on an ReFS volume.

Get-FileStorageTier

Gets the files assigned to a storage tier on a volume, and their status.

Get-InitiatorId

Gets the InitiatorID objects for the specified iSCSI initiators.

Get-InitiatorPort

Gets one or more host bus adapter (HBA) initiator ports.

Get-MaskingSet

Gets masking sets. Masking sets are used to grant access to a virtual disk or iSCSI VHD for one or more servers.

Get-OffloadDataTransferSetting

Returns offloaded data transfer (ODX) settings for the specified subsystem.

Get-Partition

Returns a list of all partition objects visible on all disks, or optionally a filtered list using specified parameters.

Get-PartitionSupportedSize

Returns information on supported partition sizes for the specified Disk object.

Get-PhysicalDisk

Gets a list of all PhysicalDisk objects visible across any available Storage Management Providers, or optionally a filtered list.

Get-ResiliencySetting

Gets the resiliency settings (also known as storage layouts) available for creating virtual disks on the specified storage subsystem.

Get-StorageEnclosure

Gets storage enclosures.

Get-StorageEnclosureVendorData

Gets vendor-specific data for an enclosure.

Get-StorageJob

Returns information about long-running Storage module jobs, such as a repair task.

Get-StorageNode

Gets storage nodes.

Get-StoragePool

Gets a specific storage pool, or a set of StoragePool objects either from all storage subsystems across all storage providers, or optionally a filtered subset based on specific parameters.

Get-StorageProvider

Returns a list of the storage providers available on the current computer.

Get-StorageReliabilityCounter

Gets the storage reliability counters for the disk or physical disk that you specify.

Get-StorageSetting

Returns the storage settings object.

Get-StorageSubsystem

Gets one or more StorageSubsystem objects.

Get-StorageTier

Gets storage tiers.

Get-StorageTierSupportedSize

Gets the supported sizes of a storage tier.

Get-SupportedClusterSizes

Gets the supported cluster sizes.

Get-SupportedFileSystems

Gets the file system choices for a specified volume.

Get-TargetPort

Returns a TargetPort object associated with a specific port address and connection type.

Get-TargetPortal

Returns a target portal object.

Get-VirtualDisk

Returns a list of VirtualDisk objects, across all storage pools, across all providers, or optionally a filtered subset based on provided criteria.

Get-VirtualDiskSupportedSize

Returns all sizes supported by a storage pool for virtual disk creation based on the specified Resiliency Setting Name.

Get-Volume

Gets the specified Volume object, or all Volume objects if no filter is provided.

Get-VolumeCorruptionCount

Gets a count of the logical and physical errors on the volume.

Get-VolumeScrubPolicy

Gets the status of the volume scrub policy.

Hide-VirtualDisk

Hides the virtual disk from the host when the Storage Management provider in use does not support masking sets.

Initialize-Disk

Initializes a RAW disk for first time use, enabling the disk to be formatted and used to store data.

Mount-DiskImage

Mounts a previously created disk image (virtual hard disk or ISO), making it appear as a normal disk.

New-MaskingSet

Creates a new masking set.

New-Partition

Creates a new partition on an existing Disk object.

New-StoragePool

Creates a new storage pool using a group of physical disks, and a specific storage subsystem exposed by a storage provider.

New-StorageSubsystemVirtualDisk

Allows the creation of a VirtualDisk object on a storage subsystem that does not support creation of storage pools.

New-StorageTier

Creates a storage tier.

New-VirtualDisk

Creates a new virtual disk in the specified storage pool.

New-VirtualDiskClone

Creates a new clone of a specified virtual disk.

New-VirtualDiskSnapshot

Creates a new snapshot of the specified virtual disk.

New-Volume

Creates a volume with the specified file system.

Optimize-Volume

Optimizes a volume.

Register-StorageSubsystem

Connects to storage subsystems on a remote computer.

Remove-InitiatorId

Removes an initiator identifier (ID).

Remove-InitiatorIdFromMaskingSet

Removes an initiator identifier (ID) from a masking set.

Remove-MaskingSet

Removes a masking set.

Remove-Partition

Deletes the specified Partition object on an existing disk and any underlying Volume objects.

Remove-PartitionAccessPath

Removes an access path such as a drive letter or folder from a partition.

Remove-PhysicalDisk

Removes a physical disk from a specified storage pool.

Remove-StoragePool

Deletes a storage pool and associated VirtualDisk objects.

Remove-StorageTier

Removes storage tiers.

Remove-TargetPortFromMaskingSet

Removes a specified target port from a masking set.

Remove-VirtualDisk

Deletes an existing virtual disk and reclaims the used space for use by other virtual disks in the same storage pool.

Remove-VirtualDiskFromMaskingSet

Removes a virtual disk from a specified masking set to block access to the virtual disk by an initiator IDs defined in the masking set.

Rename-MaskingSet

Renames an existing masking set.

Repair-FileIntegrity

Repairs a corrupted file on an NTFS or ReFS volume.

Repair-VirtualDisk

Performs repairs on a virtual disk that is unhealthy.

Repair-Volume

Performs repairs on a volume.

Reset-PhysicalDisk

Resets the status of a physical disk.

Reset-StorageReliabilityCounter

Resets storage reliability counters for a disk.

Resize-Partition

Resizes a partition and the underlying file system.

Resize-StorageTier

Increases the size of storage tiers.

Resize-VirtualDisk

Resizes an existing virtual disk to be larger or smaller.

Set-Disk

Takes a Disk object or unique disk identifiers and a set of attributes, and updates the physical disk on the system.

Set-FileIntegrity

Sets integrity for a file on an ReFS volume.

Set-FileStorageTier

Assigns a file to a storage tier.

Set-InitiatorPort

Sets properties on the InitiatorPort object.

Set-Partition

Sets attributes of a partition, such as active, read-only, and offline states.

Set-PhysicalDisk

Sets attributes on a specific physical disk.

Set-ResiliencySetting

Modifies the properties of the specified resiliency setting name.

Set-StoragePool

Modifies the properties of the specified storage pool.

Set-StorageProvider

Modifies whether to enable the SMP provider cache.

Set-StorageSetting

Adjusts or configures current storage settings of the StorageSetting object.

Set-StorageSubsystem

Sets the friendly name or description of the specified StorageSubsystem object.

Set-StorageTier

Modifies a storage tier.

Set-VirtualDisk

Modifies the attributes of an existing virtual disk.

Set-Volume

Sets or changes the file system label of an existing volume.

Set-VolumeScrubPolicy

Sets the status of the volume scrub policy.

Show-VirtualDisk

Makes a virtual disk available to a host for storage subsystems that do not support masking sets.

Unregister-StorageSubsystem

Disconnects from storage subsystems on a remote computer.

Update-Disk

Updates cached information about the specified Disk object only

Update-HostStorageCache

Initiates an update on the host storage cache to reflect the current status of storage.

Update-StoragePool

Updates the metadata of a Windows Server 2012 R2 storage pool.

Update-StorageProviderCache

Updates the cache of the service for a particular provider and associated child objects.

Write-VolumeCache

Writes the file system cache to disk.

注意

To list all the cmdlets that are available, use the Get-Command –Module Storage cmdlet.

如需有關任何 Cmdlet 的詳細資訊或其語法,請使用 Get-help <Cmdlet 名稱> Cmdlet,其中 *<Cmdlet 名稱>*是您想要研究的 Cmdlet 的名稱。如需詳細資訊,您可以執行下列任何 Cmdlet:

Get-Help <Cmdlet 名稱> -Detailed
Get-Help <Cmdlet 名稱> -Examples
Get-Help <Cmdlet 名稱> -Full

More Information

For more information about the objects that are used by these cmdlets, see the following: