Skip to main content

Proxmox

Install QEMU guest agent (Windows)

  1. Mount the virtio-win.iso and install D:\guest-agent\qemu-ga-x86_64.msi
  2. Shutdown the system.
  3. On the Proxmox system, head to Options > QEMU Guest Agent > Use QEMU Guest Agent (tick the box)
  4. Power up the VM
  5. Open devmgmt.msc - look for PCI Simple Communications Controller and right-click it, then click Update Driver
  6. Select Browse my computer for drivers and feed it the path of D:\vioserial\YOUR-WINDOWS-VERSION\amd64\
  7. Per Proxmox docs, check if the service is running in PowerShell:
Get-Service QEMU-GA
  1. Additionally, from Proxmox command line you can run qm agent xxx ping to make sure an empty prompt is returned back (if you get QEMU guest agent is not running start at step 1 and double check everything).

QM command cheat sheet

Unlock a system (that might be locked from snapshot)

qm unlock XXX

List machines

qm list

Check status on if a particular machine is booted

qm status xxx

Get full info on one VM - like if autoboot is set, hardware info, etc:

qm config xxx

Enable autoboot (if onboot does not = 1 from `qm config X')

qm set X -onboot 1

Change boot order

qm set X --startup order=2,up=60

Stop a VM

qm stop X

Take a snapshot

qm snapshot xxx NAME-OF-SNAP --description 

List snapshots

qm listsnapshot xxx

Restore a snapshot

qm rollback xxx NAME-OF-SNAP

Start a VM

qm start X
qm set VMID -net0 virtio=THE:MAC:ADDRESS:OF:THE:PC,bridge=vmbr1,link_down=1,tag=10

Run a powershell command directly against a specific VM

qm guest exec xxx -- cmd /c "dir c:\users\administrator\desktop"

Another example of downloading and then running a PowerShell script

qm guest exec 100 -- cmd /c "powershell invoke-webrequest https://somesite/script.ps1 -outfile c:\users\administrator\desktop\script.ps1"
qm guest exec 100 -- cmd /c "powershell.exe -ExecutionPolicy Bypass -File "C:\\Users\\administrator\\Desktop\\script.ps1""

Yet another rexample of installing NIC driver on a fresh Windows build

qm guest exec 100 -- cmd /c "pnputil /add-driver d:\NetKVM\w11\amd64\netkvm.inf /install"

Yet ANOTHER example of installing Chrome

qm guest exec 100 -- cmd /c "powershell Invoke-WebRequest 'https://dl.google.com/chrome/install/chrome_installer.exe' -OutFile c:\users\ttadmin\desktop\chrome_installer.exe && c:\users\ttadmin\desktop\chrome_installer.exe /silent /install"

Then tailing the last 10 lines of a log file

qm guest exec 100 -- cmd /c "powershell.exe -ExecutionPolicy Bypass -Command Get-Content -Path 'C:\\some\\path\\install.log' -Tail 10"

Check if qmagent is running

qm agent xxx ping

Delete/destroy a VM

qm destroy xxx