hyper-v-tool

My tool to create vm’s in my lab https://github.com/Lubenz007/hyper-v-tool Utilizing a standalone Hyper-V server and generating VMs from a golden image might be considered an older approach, but it’s one I personally prefer. Over the years, I’ve diligently maintained a tool for crafting VMs on my Hyper-V host within the lab environment. I employ SSH to connect to the Hyper-V host and initiate the VM creation process. This tool provides a streamlined menu system that automatically configures the VM, allowing me to promptly begin using it. ...

September 30, 2023 · 1 min · 149 words · Benedikt Gabriel Egilsson

Upgrade Hyper-V Hosts with Azure Arc

Azure Arc is a powerful tool for managing and updating hybrid infrastructure, including standalone Hyper-V hosts. Demo how to use Azure Arc to update a standalone Hyper-V host, using a scheduled update task in Automation Account and pre and post scripts that shut down and start up VMs. Pre-requisites # Stop all running VMs on the Hyper-V host and wait for them to shut down # save the names of the running VMs to a file $filePath = "C:\temp\runningvm.txt" (Get-vm | Where-Object { $_.State -eq "Running" }).name | Out-File $filePath $runningvm = Get-Content $filePath foreach ($Name in $runningvm) { Stop-VM $Name do { $VM1 = get-vm -Name $Name Write-Progress -Activity "Waiting for the VM to shutdown" } until ($Null -eq $VM1.Heartbeat) } # send a webhook to Teams to notify that the VMs have been shut down $webhookUri = "" $body = @{ "@context" = "http://schema.org/extensions" "@type" = "MessageCard" "themeColor" = "d70000" "title" = "Send Webhook to Teams" "text" = "This is a message sent from Powershell" } Invoke-RestMethod -Uri $webhookUri -Method Post -Body (ConvertTo-Json -InputObject $body) Post-requisites ...

April 4, 2023 · 2 min · 354 words · Benedikt Gabriel Egilsson