Skip to content

Instantly share code, notes, and snippets.

@weidi
Created November 11, 2020 11:56
Show Gist options
  • Select an option

  • Save weidi/13dc0fd1b4b7de065e10f851c2dcf966 to your computer and use it in GitHub Desktop.

Select an option

Save weidi/13dc0fd1b4b7de065e10f851c2dcf966 to your computer and use it in GitHub Desktop.
This will give you information about a First Class Disk in vSphere. They are use e.g. for CNS Volumes. Sometimes it´s hard to find the physical Path or the VM that claimed it.
<#
.Synopsis
This will give you information about a First Class Disk
.DESCRIPTION
This will give you information about a First Class Disk in vSphere. They are use e.g. for CNS Volumes. Sometimes it´s hard to find the physical Path or the VM that claimed it.
.EXAMPLE
Get-FCDInfo -Name "pvc-e51ba680-4e93-411a-bc9e-e30d0b8870b5"
.EXAMPLE
Get-FCDInfo -Filename "[vsanDatastore] 78f8f95e-9cf4-9c06-fbd7-08f1eaf44c56/_00b0/_0090/eda70a68ca06471e8080ef26447145b5.vmdk"
#>
function Get-FCDInfo
{
[CmdletBinding()]
param
(
[Parameter(ValueFromPipelineByPropertyName=$true,
ValueFromPipeline=$true,
Position=0)]
[string]$Name,
[string]$Filename
)
if($Name)
{
$VDisk = Get-VDisk | ? Name -Like $PVCName
$Vdisk = $vdisk | select Name, CapacityGB,Filename,Attached
$VDisk.attached = (get-vm | get-harddisk | ? Filename -eq $VDisk.Filename | Select Parent).Parent
}
elseif($Filename)
{
$VDisk = Get-VDisk | ? Filename -eq $Filename
$Vdisk = $vdisk | select Name, CapacityGB,Filename,Attached
$VDisk.attached = (get-vm | get-harddisk | ? Filename -eq $VDisk.Filename | Select Parent).Parent
}
$VDisk
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment