Changing IP network for Windows

wassim-der

New Member
Apr 29, 2024
5
0
1
I want to change via the windows vm gest method
I have this command which works on my proxmox shell ssh:

qm guest exec 112 cmd.exe /c "powershell New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 196.50.63.101 -PrefixLength 24 -DefaultGateway 196.50.63.1"

on the other hand I wanted to use the proxmox API like this:
function setVMIP($node, $vmid, $ip) {
connectToProxmox();

$data = array('command' => ('cmd.exe /c "powershell New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 196.50.63.101 -PrefixLength 24 -DefaultGateway 196.50.63.1"'),
// 'input-data' => '/c "powershell New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 196.50.63.101 -PrefixLength 24 -DefaultGateway 196.50.63.1"',
'node' => $node,
'vmid' => $vmid
);
return Nodes::setIP($node, $vmid, $data);
}

Is there anyone who has worked with this method or has another solution to change the IP of a Windows VM on proxmox?
 

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!