sorry, my question is not correct,
I would like to know how to put a username and fixed password without entering the data manually through the interface graphic.
the line of the script that uses the GUI is as follows (red color):
Function Set-WinVMIP ($VM, $HC, $GC, $IP, $SNM, $GW){
$netsh = "c:\windows\system32\netsh.exe interface ip set address ""Connexion au réseau local 2"" static $IP $SNM $GW 1"
Write-Host "Configuration de l'adresse IP de la VM $VM..."
Invoke-VMScript -VM $VM -HostCredential $HC -GuestCredential $GC -ScriptType bat -ScriptText $netsh
Write-Host "Setting IP address completed."
}
Connect-VIServer -Server 10.*.*.* -Protocol https -User admin -Password p@ssword
$VM = Get-VM Machinedetest1
$ESXHost = $VM | Get-VMHost
$GuestCred = $Host.UI.PromptForCredential("Please enter credentials", "Enter Guest credentials for $VM", "", "")
$IP = "192.168.0.13"
$SNM = "255.255.255.0"
$GW = "192.168.0.60"
Set-WinVMIP $VM $HostCred $GuestCred $IP $SNM $GW
Thanks.