Remove hard drive disks from Storage Pool (PowerShell)
Introduction
This PowerShell Script shows how to remove hard drive disks from Storage Pool.
Scenarios
It admins want to use PowerShell scripting to remove hard drive disks from Storage Pool, this script can do it.
Script
Step1: Run the script in the Windows PowerShell Console, type the one command:
Import-Module <Script Path> at the prompt.
For example, type Import-Module C:\Script\RemoveHardDriveDiskFromStoragePool.psm1
This is shown in the following figure:

Step2: You can type the
command
Get-Help
Remove-OSCPhysicalDisk -Full to display the entire help file for this function, such as the syntax, parameters, or examples.
The following command line shows how to remove physical disk “PhysicalDisk2”,”PhysicalDisk3” from Storage Pool named “NewPool”.
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
PowerShell
Edit|Remove
powershell
Set-PhysicalDisk -FriendlyName $RemoveDisk.FriendlyName -Usage Retired
Get-VirtualDisk -PhysicalDisk $(Get-PhysicalDisk -FriendlyName $phyDisk) |`
ForEach{Repair-VirtualDisk -FriendlyName $_.FriendlyName}
Remove-PhysicalDisk -StoragePoolFriendlyName $StoragePoolFriendlyName -PhysicalDisks $RemoveDisk -Confirm:$false -ErrorAction SilentlyContinue
Set-PhysicalDisk -FriendlyName $RemoveDisk.FriendlyName -Usage Retired
Get-VirtualDisk -PhysicalDisk $(Get-PhysicalDisk -FriendlyName $phyDisk) |`
ForEach{Repair-VirtualDisk -FriendlyName $_.FriendlyName}
Remove-PhysicalDisk -StoragePoolFriendlyName $StoragePoolFriendlyName-PhysicalDisks $RemoveDisk-Confirm:$false-ErrorAction SilentlyContinue
Prerequisite
Windows PowerShell 3.0
Windows Server 2012