Skip to content

Instantly share code, notes, and snippets.

@Zsoldier
Last active October 19, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zsoldier/bebbde3d3d2c90046d8fea93eb785388 to your computer and use it in GitHub Desktop.
Save Zsoldier/bebbde3d3d2c90046d8fea93eb785388 to your computer and use it in GitHub Desktop.
Delete a vSAN Disk Group Forcefully
<#
Author: K. Chris Nakagaki
Source: tech.zsoldier.com
Use at your own risk, simply listed here for demonstration purposes to use how you see fit.
#>
<# Get the host w/ problem disk group #>
$VMhost = Get-VMHost NameofHostwithProblemDiskGroup
<# ESXCLI Connection #>
$VMHostCLI = $VMHost | Get-ESXCLI -V2
<# Find your problem disk group UUID, in this case I'm looking for a disk group that doesn't exist (blank) #>
$BadDisks = $VMHostcli.vsan.storage.list.invoke() | Where-Object {$_.vsandiskgroupname -eq ""}
<# Your capacity disks should all have the same vSAN Disk Group UUID, we're just confirming it here. #>
$BadDiskGroup = $BadDisks | Select-Object -Unique -Property vsandiskgroupuuid
<# This should return only one assuming you only have one bad disk group, if more than one, then you might have more issues. #>
$BadDiskGroup
<# Below is destructive, only do it if you are ABSOLUTELY sure of what you are doing #>
$vmhostcli.vsan.storage.remove.invoke(@{"uuid"=$BadDiskGroup})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment