techthoughts2
10/28/2017 - 3:09 AM

Drives

#getting disks into a cluster
#start by identifying the disk you want to initialize
Get-Disk -Number 1 | Initialize-Disk -PartitionStyle GPT
#online the drive
Set-Disk -Number 1 -IsOffline $false
#create a new partition
New-Partition -DiskNumber 1 -UseMaximumSize
Get-Disk 2 | Set-Partition -PartitionNumber 2 -NewDriveLetter F
Format-Volume -DriveLetter F -FileSystem NTFS -AllocationUnitSize 65536

Get-Disk 1 | Add-ClusterDisk


#Get the names of the drives and drive information
$resources = Get-WmiObject -namespace root\MSCluster MSCluster_Resource -filter "Type='Physical Disk'"
$resources | foreach {
	$res = $_
	$disks = $res.GetRelated("MSCluster_Disk")
	$disks | foreach {
		$_.GetRelated("MSCluster_DiskPartition") |
		select @{ N = "Name"; E = { $res.Name } }, @{ N = "Status"; E = { $res.State } }, Path, VolumeLabel, TotalSize, FreeSpace
	}
} | ft -AutoSize

(Get-ClusterResource "Cluster Disk 3").name = "ClusterDisk1TB-1"

Add-ClusterSharedVolume -Name ClusterDisk1TB-1

Set-ClusterQuorum -DiskWitness Quorum

attributes disk clear readonly
Get-Disk -Number 3 | Reset-PhysicalDisk
Get-Disk -Number 3 | Clear-Disk