Search code examples
powershellvmwarepowercli

PowerCLI - Get VM Disk Partition Type


I'm looking to conduct an audit on our virtual environment to get the disk partition types (MBR, GPT) of our VMs. I haven't found any documentation in PowerCLI to get the partition type. Any ideas how I can go about this? Thanks!


Solution

  • That sort of information is normally not known at the VM object level and instead known at the Guest-OS level. If the VMs you're working with have VMware Tools (or Open VM Tools), you can still use PowerCLI to run scripts against them to pull that information with Invoke-VMScript (docs), but you'll still need to write your own code to pass to the guest OS to pull partition type.

    If they're windows systems, you may be able to do something as simple as:

    Invoke-VMScript -ScriptText {Get-Partition | select DriveLetter, Type} -VM VMName -GuestCredential $guestCredential