How i can change a VM Ip Address from script?

Well, read below!

With PowerCli a powershell addon you can do the job!

Warning,  Network connection name must be « Local Area Connection ». Of course you can modify this script.

Function VMIP ($VM, $Esxi, $VM_Password, $IP, $SubNet, $Gateway){
 $netsh = "C:\windows\system32\netsh.exe interface ip set address ""Local Area Connection"" static $IP $SubNet $Gateway 1"
 Write-Host " "
 Write-Host "Setting IP address for $VM..." -ForegroundColor Yellow
 Invoke-VMScript -VM $VM -HostCredential $Esxi -GuestCredential $VM_Password -ScriptType bat -ScriptText $netsh
 Write-Host " "
 Write-Host "Setting IP address completed." -ForegroundColor Yellow
 Write-Host " "

$VM = Get-VM ( Read-Host "Enter VM name" )
Write-Host " "
$IP = Read-Host "Enter VM New IP"
Write-Host " "
$SubNet = Read-Host "Enter SubNet"
Write-Host " "
$Gateway = Read-Host "Enter Gateway"

$ESXHost = $VM | Get-VMHost
$HostCred = $Host.UI.PromptForCredential("Please enter credentials", "Enter ESX host credentials for $ESXHost", "root", "")
$GuestCred = $Host.UI.PromptForCredential("Please enter credentials", "Enter Guest credentials for $VM", "", "")

VMIP $VM $HostCred $GuestCred $IP $SubNet $Gateway

Hope it help!