发新话题
打印

Windows下查询修改网卡的MAC地址

Windows下查询修改网卡的MAC地址

查询MAC地址:
getmac /V

查询网卡:
netsh interface show interface

查询当前活动的网卡的NetCfgInstanceId信息(不显示未连接的VPN网卡):
net config rdr

查询OpenVPN网卡的NetCfgInstanceId信息:
"C:\Program Files\SSLVPN\bin\openvpn" --show-adapters

查询注册表中网卡信息:
REG QUERY HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318} /v NetCfgInstanceId  /s

禁用网卡
"C:\Program Files\SSLVPN\bin\devcon.exe" disable  tap0901
或 "C:\Program Files\SSLVPN\bin\devcon.exe" disable  @"ROOT\NET\0001"
或 netsh interface set interface openvpn1 disable  (由netsh interface show interface 或 getmac /V 得知 openvpn1)

启用网卡
"C:\Program Files\SSLVPN\bin\devcon.exe" enable  tap0901
或 "C:\Program Files\SSLVPN\bin\devcon.exe" enable  @"ROOT\NET\0001"
或 netsh interface set interface openvpn1 enable  (由netsh interface show interface 或 getmac /V 得知 openvpn1)

修改注册表网卡的MAC地址:
REG  add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001 /v MAC /t REG_SZ /d 00-FF-F7-42-73-F3 /f
之后再禁用、启用网卡,使之生效。

Powershell操作:
Get-NetAdapter
Set-NetAdapter -Name "Ethernet 1" -MacAddress "00-10-18-57-1B-0D"

参考:
https://stackoverflow.com/questions/8753043/how-to-change-mac-address-with-batch-file-on-windows-7
https://windowsreport.com/mac-address-changer-windows-10/
https://docs.microsoft.com/en-us/powershell/module/netadapter/set-netadapter?view=win10-ps

[ 本帖最后由 linda 于 2019-9-19 18:37 编辑 ]

TOP

发新话题