0
請讓我知道如何通過ip地址,子網掩碼,網關,而腳本如何參數傳遞到netsh命令
下面的執行腳本:
$VMNetworkSettings = 'netsh interface ip set address "Ethernet0" static x.x.x.x(ipaddress) x.x.x.x(subnet mask) x.x.x.x(gateway)'
我曾嘗試下面的方法實現卻得到了一個錯誤信息爲無效參數
$Ip = Read-Host -Prompt "Enter the ip address"
$sub = Read-Host -Prompt "Enter the subnet"
$gateway = Read-Host -Prompt "Enter the gateway"
$VMNetworkSettings = 'netsh interface ip set address "Ethernet0" static $Ip $sub $gateway'