Remove hard drive disks from Storage Pool (PowerShell)


This PowerShell Script shows how to remove hard drive disks from Storage Pool.


It admins want to use PowerShell scripting to remove hard drive disks from Storage Pool, this script can do it.


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.
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 


Windows PowerShell 3.0
Windows Server 2012