PowerEdge: Cleaning S2D Disks and destruction of old Storage Spaces Direct

Summary: How to Clear Storage spaces direct while leaving data on USB drives.

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Cleaning S2d Disks and destruction of old Storage Spaces Direct
 

Be Advised this destroys data! This script prepares a pool to redeploy!
 
This guide and other Guides have a Microsoft Script which cleans the Storage pool to be able to redeploy a Storage Spaces Direct pool.
 
Deploy Storage Spaces Direct on Windows Server | Microsoft Learn.This hyperlink is taking you to a website outside of Dell Technologies.
Deploy Storage Spaces Direct on Windows Server | Microsoft Learn.This hyperlink is taking you to a website outside of Dell Technologies. 
 
The Problem with this script is it any USB data is gone including any drives which may be plugged in. USB drives are often used with remote deployments. Running this script included below can result in unintended data loss. The script below prevents a drive to the site again to replace the data on the USB device.  
 
The Adjusted Script is below. This script does not delete USB drive data.

$ServerList = "Server1", "Server2", "Server3"
 
Invoke-Command ($ServerList) {
Update-StorageProviderCache
Get-StoragePool | ? IsPrimordial -eq $false | Set-StoragePool -IsReadOnly:$false -ErrorAction SilentlyContinue
      Get-StoragePool | ? IsPrimordial -eq $false | Get-VirtualDisk | Remove-VirtualDisk -Confirm:$false -ErrorAction SilentlyContinue
      Get-StoragePool | ? IsPrimordial -eq $false | Remove-StoragePool -Confirm:$false -ErrorAction SilentlyContinue
      Get-PhysicalDisk | Reset-PhysicalDisk -ErrorAction SilentlyContinue
      Get-Disk | ? Number -ne $null | ? IsBoot -ne $true | ? IsSystem -ne $true | ? PartitionStyle -ne RAW | ? BusType -ne USB | % {
           $_ | Set-Disk -isoffline:$false
           $_ | Set-Disk -isreadonly:$false
           $_ | Clear-Disk -RemoveData -RemoveOEM -Confirm:$false
           $_ | Set-Disk -isreadonly:$true
           $_ | Set-Disk -isoffline:$true
      }
      Get-Disk | Where Number -Ne $Null | Where IsBoot -Ne $True | Where IsSystem -Ne $True | Where PartitionStyle -Eq RAW | Group -NoElement -Property FriendlyName
} | Sort -Property PsComputerName, Count



 
 

Affected Products

AX Nodes, Dell EMC Microsoft Storage Spaces Direct Ready Nodes, Microsoft Windows Server 2016, Microsoft Windows Server 2019, Microsoft Windows Server 2022, Microsoft Windows Server 2025

Products

Software Defined Storage
Article Properties
Article Number: 000212092
Article Type: How To
Last Modified: 13 Jun 2025
Version:  3
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.