Convert vhd to vhdx

Downloaded a vhd from azure added it to gen1 vm however only showed blinking cursor Created gen 2 vm however could not add the vhd issue reading it Converted vhd to vhdx and was able to boot On VM setting go to disk Edit Choose action Convert select VHDX set type fixed or dynamic set location finish on hyper v settings edit disk browser to disk Choose action Convert select VHDX set type fixed or dynamic set location finish...
Read More

Bulk update VHD Location on Hyper-V Host

used for is you have already moved the files, for instance I updated from using the computer name \\storage\ to the FQDN   get Excel file get-VMHardDiskDrive -VMName * | select VMName,ControllerType,ControllerNumber,ControllerLocation,Path | Export-Csv -Delimiter ";" -Path "c:\temp\vmvhdloc.csv" In excel file update path to what you want it to be (note this does not move the file) import-csv c:\temp\vmvhdloc.csv | ForEach-Object { set-VMHardDiskDrive -VMName $_.VM -ControllerType $_.CT -ControllerNumber 0 -ControllerLocation $_.CL -Path $_.newpath } get-vm * | Get-VMHardDiskDrive  ...
Read More

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