Failover Cluster manager – get list of Vm’s and if a VM has a DVD (iso file)

Powershell Get-ClusterGroup -Cluster 19-hv | ? {$_.GroupType –eq 'VirtualMachine' } | Get-VM | Get-VMDvdDrive   19-hv is the cluster name I have created VMName ControllerType ControllerNumber ControllerLocation DvdMediaType Path ------ -------------- ---------------- ------------------ ------------ ---- 19-RDSH SCSI 0 1 None 2016DC-1 SCSI 0 1 None 2019 SCSI 0 1 None Android IDE 1 0 ISO \\fs1\OS\Linux\android-x86-5.1-rc1.iso AzureADConnect2 SCSI 0 1 None CentOS-G1 IDE 1 0 None Domonitor SCSI 0 1 None exchange IDE 1 0 None FireflyIII IDE 1 0 None G2-testboot SCSI 0 1 None GMVault SCSI 0 1 None GW2 SCSI 0 1 None JenkinsTestServer IDE 1 0 None LanSweep SCSI 0 1 None leSSL1 IDE 1 0 None MCS2(Toms Server) IDE 1 0 None MCS3 SCSI 0 1 None MCS4 SCSI 0 1 None Mgmt1 SCSI 0 1 None MineOS-G1 IDE 1 0 None Observium SCSI 0 1 None ODSPSync SCSI 0 1 None PFsense SCSI 0 1 None PFSenseG1 IDE 1 0 None Proxmox-G1 IDE 1 0 None SharePoint 2019 SCSI 0 1 None Sharepoint1 SCSI 0 1 None SQL SCSI 0 1 None Steam-Cache SCSI 0 1 None SYSDeploy SCSI 0 2 None SYSDEPLOY1 IDE 1 0 None SYSWebM1 IDE 1 0...
Read More

Hyper-V get VM VHD Used and Provisioned Storage

Open Powershell as admin   Get-VM | ForEach { $Vm = $_; $_.HardDrives } | ForEach { $GetVhd = Get-VHD -Path $_.Path [pscustomobject]@{ Vm = $Vm.Name Name = $_.Name Type = $GetVhd.VhdType ProvisionedGB = ($GetVhd.Size / 1GB) CommittedGB = ($GetVhd.FileSize / 1GB) } } | Export-Csv -Delimiter ";" -Path "C:\temp\VMVHDStorageUsedTotal.csv"   Creates CSV with data in one column, select column in excel, go to data tab, then text to columns > Delimiter > Semicolon Excel file would look like this: Vm Name Type ProvisionedGB CommittedGB GW1 Hard Drive on IDE controller number 0 at location 0 Dynamic 60 45.12890625 GW2 Hard Drive on SCSI controller number 0 at location 0 Dynamic 40 28.97265625 ...
Read More

hyper-v Enable processor compatibility

Enabling this feature manually on each vm, via settings processor > expand > Compatibility > tick Migrate to a physical computer with a different processor version   View current status of all vm's on a host. PS C:\WINDOWS\system32> Get-VM | get-VMProcessor VMName Count CompatibilityForMigrationEnabled CompatibilityForOlderOperatingSystemsEnabled ------ ----- -------------------------------- -------------------------------------------- Activation-Test 1 False False AzureADConnect2 1 False False AzureBackup1 2 False False exchange 4 False False Proxy1 1 False False RDSHost (rdvh1) 1 False False SCCM (WSUS) 2 False False Steam-Cache 2 False False SYSDeploy 2 False False TesVMG1 1 False False TesVMG2 1 True False vd1-H0 1 False False vd1-H1 1 True False w10IotE 1 False False Windows10-vdi-m 1 False False Windows10-vdi-v1 1 False False Update all vm's on host (only updates vms that are powered off.) PS C:\WINDOWS\system32> Get-VM | set-VMProcessor -CompatibilityForMigrationEnabled $true   After (only updates VMs that are powered off) PS C:\WINDOWS\system32> Get-VM | get-VMProcessor VMName Count CompatibilityForMigrationEnabled CompatibilityForOlderOperatingSystemsEnabled ------ ----- -------------------------------- -------------------------------------------- Activation-Test 1 True False AzureADConnect2 1 False False AzureBackup1 2 False False exchange 4 True False Proxy1 1 True False RDSHost (rdvh1) 1 False False SCCM (WSUS) 2 False False Steam-Cache 2 True False SYSDeploy 2 True False TesVMG1 1 True False TesVMG2...
Read More

VM kept a recovery checkpoint

Not sure why this occurred however I was planning to add a new drive to a vm, however could not add the new drive. Thinking back to an issue with a VM at work, on my VM exchange I tried to edit an existing drive on the VM and it mentions checkpoints exist. In poweshell I did get-vmsnapshot Exchange it mentioned it was a recovery checkpoint The command I used to remove it was get-vmsnapshot exchange | remove-vmsnapshot Below is a screenshot of the CMD/Powershell window ...
Read More

Export list of Mac addresses used by Hyper-V VMs

Run Powershell as admin Get-vm | Get-VMNetworkAdapter | select-object VMname, Macaddress, Name | Export-Csv -Delimiter ";" -Path C:\vmmacs.csv VMName = name of the virtual machine Macaddress = Mac of the VM being used Name = The type of network adapter being used such as Network Adapter and Legacy Network Adapter Delimiter is ; which is how they are spaced out so that you can convert from text to collumn. Open the file in Excel, select the column, then click on Data tab then text to columns, select delimited and click on next and then ensure only semicolon is ticked, and then click finish   ...
Read More

Hide Hyper V Floppy Disk Drive via group policy

On Any Hyper-V virtual machine it adds the Floppy disk drive, and there is not an option to remove the drive from the settings window of the VM   The Way to remove this drive is by changing a value in the registry of the virtual machine that is running windows. However as I join my VMs to a domain I can utilise group policy to apply this change I created a new group policy called "Remove Hyper V Floppy disk drive" I went into Computer configuration > preferences > windows Settings > Registry From there I right clicked on registry and selected new > Registry item And set the following values: Action: Update Hive: HKey_Local_Machine Key Path: SYSTEM\CurrentControlSet\Services\flpydisk Value name: Start Value Type: REG_DWORD Value: 4 Base: Decimal Then I clicked Apply and OK   I applied it to the root of the domain so that it would apply to all devices on the domain...
Read More

Hyper-V Guest Operating Systems that support Dynamic Memory

Linux distributions For details on Linux distributions and versions that support dynamic memory, and the requirements for Linux Integration Services, see Linux and FreeBSD Virtual Machines on Hyper-V. Windows Server 2012 and Windows Server 2012 R2 Datacenter, Standard, and Essentials editions. Integration services are built-in and do not require a separate download and installation. Windows 8 and Windows 8.1 Windows 8, Windows 8 Pro, and Windows 8 Enterprise editions. Windows 8.1, Windows 8.1 Pro, and Windows 8.1 Enterprise editions. Integration services are built-in and do not require a separate download and installation. Windows Server 2008 R2 with Service Pack 1 (SP1) Datacenter, Enterprise, Standard, and Web editions. Windows Server 2008 R2 Datacenter and Enterprise editions. Windows 7 Enterprise and Ultimate editions (32-bit and 64-bit). ...
Read More

Enabling Nested Virtualization

A Hyper-V host running Windows Server 2016 or Windows 10 Anniversary Update. A Hyper-V VM running Windows Server 2016 or Windows 10 Anniversary Update. A Hyper-V VM with configuration version 8.0 or greater. An Intel processor with VT-x and EPT technology. Shutdown VM Open Powershell as admin and run this command on Hyper-V host "Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true When using Nested Virtualization you can not use dynamic memory. Set to VM to Static memory if it isn't already Start VM Install Hyper V role More info: https://docs.microsoft.com/en-gb/virtualization/hyper-v-on-windows/user-guide/nested-virtualization   Script that will prompt you to enter name of VM $Server = Read-Host -Prompt 'Input your server name' Set-VMProcessor -VMName $Server -ExposeVirtualizationExtensions $true...
Read More