Skip to content

Instantly share code, notes, and snippets.

@MattHodge
Created February 5, 2016 13:03
Show Gist options
  • Save MattHodge/0d3401a52f2a7080719a to your computer and use it in GitHub Desktop.
Save MattHodge/0d3401a52f2a7080719a to your computer and use it in GitHub Desktop.
ReplaceStorageSpacesFailedDisk.ps1
# 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