Created
February 5, 2016 13:03
-
-
Save MattHodge/0d3401a52f2a7080719a to your computer and use it in GitHub Desktop.
ReplaceStorageSpacesFailedDisk.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the failed Disk | |
Get-PhysicalDisk | |
# Shutdown, take the disk out and reboot. Set the missing disk to a variable | |
$missingDisk = Get-PhysicalDisk | Where-Object { $_.OperationalStatus -eq 'Lost Communication' } | |
# Retire the missing disk | |
$missingDisk | Set-PhysicalDisk -Usage Retired | |
# Find the name of your new disk | |
Get-PhysicalDisk | |
# Set the replacement disk object to a variable | |
$replacementDisk = Get-PhysicalDisk –FriendlyName PhysicalDisk1 | |
# Add replacement Disk to the Storage Pool | |
Add-PhysicalDisk –PhysicalDisks $replacementDisk –StoragePoolFriendlyName pool | |
# Repair each Volume | |
Repair-VirtualDisk –FriendlyName <VolumeName> | |
# Get the status of the rebuilds | |
Get-StorageJob | |
# Remove failed Virtual Disks | |
Remove-VirtualDisk –FriendlyName <FriendlyName> | |
# Remove the failed Physical Disk from the pool | |
Remove-PhysicalDisk –PhysicalDisks $missingDisk –StoragePoolFriendlyName pool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment