KVM Windows static IP, Hostname and Administrator password change script

hitman

Renowned Member
Jan 5, 2018
111
30
68
36
Hallo Leute,

anbei sende ich heute ein kleines Tool gilt nur für Windows VMs.

Funktionen über die PVE (Linux) Shell:

1. Ändern der Ipv4 Adresse
2. Ändern des Hostname
3. Passwörter von Benutzern ändern
4. Neustarten der VM

Wenn jemand noch eine Idee hat gerne her damit ;-)
 
Last edited:
Hallo Leute,

anbei eine neue Version, wo man halt nur eine Datei kopieren muss.

#1
Install Windows VM with Qemu Guest Tools activate Guest Tools on Proxmox ;-)

#2
Copy "kvm.bat" file form ZIP to C:/Windows/System32

#3 Commands for PVE Node of VM

// Change the Hostname and FQDN for KVM VM 210
qm guest exec 210 kvm hostname vm210 yourdomain.com

// Change the Password form User Administrator for KVM VM 210
qm guest exec 210 kvm password Administrator YourPassword

// Change the IPv4 form NetworkCard for KVM VM 210
qm guest exec 210 kvm ipv4 192.168.1.10 255.255.255.0 192.168.1.1

// Reboot Windows VM
qm guest exec 210 kvm reboot

Only testing by PVE 5.3 and virtIO WIN ISO 0.1.160.
 

Attachments

  • kvm_bat.zip
    967 bytes · Views: 106
Last edited:
Hello, may I ask which version of PVE is available? I tried version 5.2, but qm has no guest exec command.
 

Hello, I know where PVE is downloaded。 But my qm has no guest exec command

root@vcloud01:~# qm
agent destroy listsnapshot nbdstop resume shutdown suspend vncproxy
clone help migrate pending rollback snapshot template wait
config importdisk monitor rescan sendkey start terminal
create importovf move_disk reset set status unlink
delsnapshot list mtunnel resize showcmd stop unlock

I am using the 5.2-1 version. Is it ‘qm guest exec‘ is the command included in the previous version?
 
transplant the qm guest code to 5.2, the self-test is available.
Pve:5.2.1
Virtio: 141
Os: win7
 
UPDATE!

#1
Install Windows VM with Qemu Guest Tools activate Guest Tools on Proxmox ;-)

#2
Copy "kvm.bat" file form ZIP to C:/Windows/System32

#3 Commands for PVE Node of VM 999 is VM ID

###############################
Host
###############################
// Change the Hostname and FQDN
qm guest exec 999 kvm hostname vm999 yourdomain.com

// Change the Password form User Account Administrator
qm guest exec 999 kvm password Administrator YourPassword

// Reboot Windows VM
qm guest exec 999 kvm reboot

###############################
Network IPv4
###############################
// IPv4 Adresse
qm guest exec 999 kvm ipv4 192.168.1.10 255.255.255.0

// IPv4 Gateway
qm guest exec 999 kvm ipv4_gw 192.168.1.1

// IPv4 DNS
qm guest exec 999 kvm ipv4_dns 8.8.8.8

###############################
Network IPv6
###############################
// IPv6 Adresse
qm guest exec 999 kvm ipv6 2001:1111:2222:3333::100 64

// IPv6 Gateway
qm guest exec 999 kvm ipv6_gw 2001:1111:2222:3333::1

// IPv6 DNS
qm guest exec 999 kvm ipv6_dns 2001:4860:4860::8888
 

Attachments

  • KVM.zip
    1.1 KB · Views: 104
UPDATE!

#1
Install Windows VM with Qemu Guest Tools activate Guest Tools on Proxmox ;-)

#2
Copy "kvm.bat" file form ZIP to C:/Windows/System32

#3 Commands for PVE Node of VM 999 is VM ID

###############################
Host
###############################
// Change the Hostname and FQDN
qm guest exec 999 kvm hostname vm999 yourdomain.com

// Change the Password form User Account Administrator
qm guest exec 999 kvm password Administrator YourPassword

// Reboot Windows VM
qm guest exec 999 kvm reboot

###############################
Network IPv4
###############################
// IPv4 Adresse
qm guest exec 999 kvm ipv4 192.168.1.10 255.255.255.0

// IPv4 Gateway
qm guest exec 999 kvm ipv4_gw 192.168.1.1

// IPv4 DNS
qm guest exec 999 kvm ipv4_dns 8.8.8.8

###############################
Network IPv6
###############################
// IPv6 Adresse
qm guest exec 999 kvm ipv6 2001:1111:2222:3333::100 64

// IPv6 Gateway
qm guest exec 999 kvm ipv6_gw 2001:1111:2222:3333::1

// IPv6 DNS
qm guest exec 999 kvm ipv6_dns 2001:4860:4860::8888


I can't exec command network (dns , ip). So you can update kvm.bat
 
Hallo Leute,

anbei eine neue Version, wo man halt nur eine Datei kopieren muss.

#1
Install Windows VM with Qemu Guest Tools activate Guest Tools on Proxmox ;-)

#2
Copy "kvm.bat" file form ZIP to C:/Windows/System32

#3 Commands for PVE Node of VM

// Change the Hostname and FQDN for KVM VM 210
qm guest exec 210 kvm hostname vm210 yourdomain.com

// Change the Password form User Administrator for KVM VM 210
qm guest exec 210 kvm password Administrator YourPassword

// Change the IPv4 form NetworkCard for KVM VM 210
qm guest exec 210 kvm ipv4 192.168.1.10 255.255.255.0 192.168.1.1

// Reboot Windows VM
qm guest exec 210 kvm reboot

Only testing by PVE 5.3 and virtIO WIN ISO 0.1.160.
hi, tks your kvm.bat
so have linux bash. tks
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!