Help me activate virtualization in my windows vm


It doesn’t allow me to activate hyper-v in my Windows virtual machine, I get an error when I try to activate virtualization, I need help please.

5 Likes

Hello @Cerate1631 ,Welcome on Google Cloud Community.

  1. If you want to enable Hyper-V, you must choose proper machine tier and enable nested-virtualization on particular VM, list can be found here:

  1. Then, enable nested virtualization by following this URL: https://cloud.google.com/compute/docs/instances/nested-virtualization/enabling

2a: execute this command to export VM:

gcloud compute instances export VM_NAME \
  --destination=nested.yaml \
  --zone=ZONE_WHERE_VM_HAS_BEEN_CREATED

EXAMPLE:

gcloud compute instances export nested \
  --destination=nested.yaml \
  --zone=us-central1-a

2b: Then edit exported file and add:

advancedMachineFeatures:
  enableNestedVirtualization: true

EXAMPLE:

canIpForward: false
confidentialInstanceConfig:
  enableConfidentialCompute: false
cpuPlatform: Intel Sapphire Rapids
creationTimestamp: '2024-07-01T00:16:56.627-07:00'
deletionProtection: false
description: ''
disks:
- autoDelete: true
  boot: true
  deviceName: nested
  diskSizeGb: 50
  guestOsFeatures:
  - type: MULTI_IP_SUBNET
  - type: UEFI_COMPATIBLE
  - type: VIRTIO_SCSI_MULTIQUEUE
  - type: GVNIC
  - type: WINDOWS
  index: 0
  interface: NVME
  kind: compute#attachedDisk
  licenses:
  - https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-2022-dc
  mode: READ_WRITE
  source: https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/zones/us-central1-a/disks/nested
  type: PERSISTENT
displayDevice:
  enableDisplay: false
fingerprint: R6HmzeAzrQI=
id: 1445920963994577161
keyRevocationActionType: NONE
kind: compute#instance
labelFingerprint: vQHfasn4SFs=
labels:
  goog-ops-agent-policy: v2-x86-template-1-3-0
lastStartTimestamp: '2024-07-01T00:17:09.014-07:00'
machineType: https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/zones/us-central1-a/machineTypes/c3-standard-4
metadata:
  fingerprint: 4Dx7qOFsseo=
  items:
  - key: enableNestedVirtualization
    value: 'true'
  - key: enable-osconfig
    value: 'TRUE'
  - key: enable-oslogin
    value: 'true'
  - key: windows-keys
    value: '{"expireOn":"2024-07-01T07:23:39.4933
  kind: compute#metadata
minCpuPlatform: Intel Sapphire Rapids
name: nested
networkInterfaces:
- accessConfigs:
  - kind: compute#accessConfig
    name: External NAT
    natIP: 104.197.182.229
    networkTier: PREMIUM
    type: ONE_TO_ONE_NAT
  fingerprint: R0DaWkrpqa8=
  kind: compute#networkInterface
  name: nic0
  network: https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/global/networks/default
  networkIP: 10
  nicType: GVNIC
  stackType: IPV4_ONLY
  subnetwork: https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/regions/us-central1/subnetworks/default
reservationAffinity:
  consumeReservationType: ANY_RESERVATION
scheduling:
  automaticRestart: true
  onHostMaintenance: MIGRATE
  preemptible: false
  provisioningModel: STANDARD
selfLink: https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/zones/us-central1-a/instances/nested
serviceAccounts:
- email: 
  scopes:
  - https://www.googleapis.com/auth/cloud-platform
shieldedInstanceConfig:
  enableIntegrityMonitoring: true
  enableSecureBoot: false
  enableVtpm: true
shieldedInstanceIntegrityPolicy:
  updateAutoLearnPolicy: true
startRestricted: false
status: RUNNING
tags:
  fingerprint: 6smc4R4d39I=
  items:
  - http-server
  - https-server
zone: https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/zones/us-central1-a
advancedMachineFeatures:
  enableNestedVirtualization: true

2c: update VM:

gcloud compute instances update-from-file VM_NAME \
  --source=YOUR_FILE.yaml \
  --most-disruptive-allowed-action=RESTART \
  --zone=ZONE_WHERE_YOUR_VM_HAS_BEEN_CREATED

EXAMPLE:
gcloud compute instances update-from-file nested \
  --source=nested.yaml \
  --most-disruptive-allowed-action=RESTART \
  --zone=us-central1-a
  1. Once done, you should be able to install Hyper-V.


cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

1 Like