Getting VHD size plus info using PowerShell for the all Virtual Machines on the cluster

Hi Guys,

This is was not a simple task… because of Get-VMHardDiskDrive can’t give you the size of the drive.

$VMget=Get-VM -ComputerName (Get-ClusterNode -Cluster ClusterName) | Get-VMHardDiskDrive | Select-Object -Property vmname, vmid, computername, controllertype, controllernumber,controllerlocation,path
foreach ($VM in $VMget) {
$VHDRemotePath=$VM.Path -replace ":", "$"
$vhdsize= Get-ChildItem $VHDRemotePath | select-object @{Name="SizeGB";Expression={"{0:N2}" -f ($_.length / 1GB)}}
$text = $VM.VMName + " , " + $vhdsize.SizeGB + "GB , " + $VM.Path
$text | out-file C:\Temp\VHD_Size.csv -Append

It exports to CSV however you still have to use “Text to Columns” in Excel.

Enjoy 🙂

How to uninstall Windows Server Essentials Experience

Simple tip.

1. Cancel the Initial Configuration Wizard on the physical host
2. RUN -> Regedit
3. Remove the registry key telling the Wizard to auto-load:

Delete the entry named: EssentialsRoleConfigWizard

4. Open Server Manager and remove ALL roles/features, EXCEPT those specified below:
* ROLES left installed: Storage Services
* FEATURES left installed: .NET Framework 4.5(no ASP or WCF), SMB 1.0/CIFS, Graphical Management Tools, Server Graphical Shell, PowerShell 4.0, WoW64 Support
5. After removing roles/features and rebooting, you can go ahead and install the Hyper-V role then create your VM