How to keep the VM boot state is not shut down?

First I would try to prevent that in the guests OS. Like removing the interface buttons for a shutdown.

And wouldn't be that hard to write a bash script that runs on the server using cron and checks if a VM is shutdown and if it finds one that should be running it could start it.

You just would need to have a list of VMIDs that should always be running, step through that list all 5 minutes or so and then use qm status <VMID> to check if the VM is running, if it is not it could be started with qm start <VMID>.

Edit:
Something like:
Code:
#!/bin/bash

VMIDLIST=(100 101 102 103) # list of VMIDs that should always be running

for vmid in ${VMIDLIST[*]}
do
    if [ $(qm status $vmid) == "status: stopped" ]; then
        qm start $vmid
    fi
done
 
Last edited:
For Win10 you can remove it using policies like for example described here. I guess for Win11 there should be something similar.