Delete Spanned Drives (Dynamic Volumes) via Powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-2370967%22%20slang%3D%22en-US%22%3EDelete%20Spanned%20Drives%20(Dynamic%20Volumes)%20via%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2370967%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20guys%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20relatively%20new%20to%20PowerShell%2C%20and%20I've%20done%20some%20research%20but%20still%20cannot%20find%20an%20answer%20to%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20delete%20a%20Spanned%20Volume%20via%20PowerShell%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EI%20am%20able%20to%20delete%20Simple%20Volume%20with%20the%20command%20below%2C%20but%20this%20doesn't%20work%20for%20Spanned%20Volume%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ERemove-Partition%20-DriveLetter%20%22%3CDRIVE%20letter%3D%22%22%3E%22%3C%2FDRIVE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20please%20help%20out%20%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(I%20actually%20need%20to%20use%20this%20in%20an%20Ansible%20Script)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2370967%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2371030%22%20slang%3D%22en-US%22%3ERe%3A%20Delete%20Spanned%20Drives%20(Dynamic%20Volumes)%20via%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2371030%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3Eusing%20command%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Ediskpart%3CBR%20%2F%3Elist%20volume%3CBR%20%2F%3Eselect%20volume%20%3CNUMBER%3E%3CBR%20%2F%3Edelete%20volume%3C%2FNUMBER%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EUsing%20Powershell%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-Volume%3CBR%20%2F%3Edrive%20letter%20(ex%3A%20%22E%22)%3CBR%20%2F%3ERemove-Partition%20-DriveLetter%20%22%3CDRIVE%20letter%3D%22%22%3E%22%3C%2FDRIVE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2371101%22%20slang%3D%22en-US%22%3ERe%3A%20Delete%20Spanned%20Drives%20(Dynamic%20Volumes)%20via%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2371101%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F307733%22%20target%3D%22_blank%22%3E%40Seshadrr%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThank%20you%20for%20your%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20the%20PowerShell%20and%20it%20doesn't%20work%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Mervin1603_0-1621497423589.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F282104iDCA28E609FC5F468%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Mervin1603_0-1621497423589.png%22%20alt%3D%22Mervin1603_0-1621497423589.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Mervin1603_1-1621497457480.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F282105i14FE74C0DC9C83AE%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Mervin1603_1-1621497457480.png%22%20alt%3D%22Mervin1603_1-1621497457480.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20you%20can%20see%2C%20Drive%20Letter%20J%20is%20my%20Spanned%20Drive.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ECan%20you%20help%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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?