家用电脑安装了一台虚拟机,默认没有配置网络,本来是想利用PowerShell启用无线网络,可是安装过程需要在线获取一些文件,所以失败,无奈只能配置静态IP地址了,参考了Ed Wilson的:Use PowerShell to Configure Static IP and DNS Settings
1
2
3
4
|
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"
$wmi.EnableStatic("192.168.1.15", "255.255.255.0")
$wmi.SetGateways("192.168.1.1", 1)
$wmi.SetDNSServerSearchOrder("8.8.8.8")
|