Powershell - how to create network adapter (loopback)?

﹥>﹥吖頭↗ 提交于 2019-12-24 08:34:41

问题


I want to create a loopback network adapter with powershell.

I can get an adapter using code like this.

$networkAdapter = Get-WMIObject win32_NetworkAdapter | where{$_.ServiceName -eq 'msloop'}

However, I cannot seem to find how to create an adapter. The only thing I found uses devcon.exe

.\devcon.exe -r install $env:windir\Inf\Netloop.inf *MSLOOP | Out-Null

This is going to be for a windows 7 box and I didn't want to have to install some other package just to do it. If devcon is required then is there a way to include the download and setup in the script as well?

来源:https://stackoverflow.com/questions/7535060/powershell-how-to-create-network-adapter-loopback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!