Delete Spanned Drives (Dynamic Volumes) via Powershell

Copper Contributor

Hello guys,

 

I am relatively new to PowerShell, and I've done some research but still cannot find an answer to that.

 

Is there a way to delete a Spanned Volume via PowerShell?

I am able to delete Simple Volume with the command below, but this doesn't work for Spanned Volume:

Remove-Partition -DriveLetter "<Drive Letter>"

 

Can someone please help out ? 

 

(I actually need to use this in an Ansible Script)

 

2 Replies

using command

diskpart
list volume
select volume <number>
delete volume

 

Using Powershell

 

Get-Volume
drive letter (ex: "E")
Remove-Partition -DriveLetter "<Drive Letter>"

Hi @Seshadrr,


Thank you for your response.

 

I tried the PowerShell and it doesn't work:

 

Mervin1603_0-1621497423589.png

 

Mervin1603_1-1621497457480.png

 

 

As you can see, Drive Letter J is my Spanned Drive.


Can you help?