option
explicit
dimobjswbemservices
asswbemservices
dimobjswbemobjectset
asswbemobjectset
dimobjswbemobject
asswbemobject
'text1(0)為ip位址、text1(1)為子網掩碼、text1(2)為預設閘道器、text1(3)為dns
private
subform_load()
setobjswbemservices
=getobject("
winmgmts:")
setobjswbemobjectset
=objswbemservices.execquery(
"select * from win32_networkadapterconfiguration where ipenabled=true")
foreach
objswbemobject in objswbemobjectset
combo1.additem objswbemobject.description
'新增本機上已經安裝了tcp/ip協議的網絡卡
next
combo1.text
=combo1.list(0)
combo1.listindex =0
end sub
private
subform_unload(cancel
asinteger
)set
objswbemservices
=nothing
setobjswbemobjectset
=nothing
setobjswbemobject
=nothing
end sub
'當選擇了網絡卡後,顯示當前所選網絡卡的設定
private
subcombo1_click()
setobjswbemobjectset
=objswbemservices.execquery(
"select * from win32_networkadapterconfiguration where description='"&
combo1.text &"
'")for
each
objswbemobject in objswbemobjectset
ifobjswbemobject.dhcpenabled
then
text1(
0).text =""
text1(
1).text =""
text1(
2).text =""
ifisnull
(objswbemobject.dnsserversearchorder)
then
text1(
3).text =""
else
text1(
3).text
=objswbemobject.dnsserversearchorder(0)
endif
else
text1(
0).text
=objswbemobject.ipaddress(0)
text1(
1).text
=objswbemobject.ipsubnet(0)
text1(
2).text
=objswbemobject.defaultipgateway(0)
text1(
3).text
=objswbemobject.dnsserversearchorder(0)
endif
next
end sub
'設定網絡卡的ip位址、子網掩碼、預設閘道器和dns
private
subcommand1_click()
setobjswbemobjectset
=objswbemservices.execquery(
"select * from win32_networkadapterconfiguration where description='"&
combo1.text &"
'")for
each
objswbemobject in objswbemobjectset
objswbemobject.enablestatic
array
(text1(
0).text),
array
(text1(
1).text)
objswbemobject.setgateways
array
(text1(
2).text)
objswbemobject.setdnsserversearchorder
array
(text1(
3).text)
next
end sub
private
subcommand2_click()
unload me
end sub
CentOS Linux 網絡卡設定 IP位址配置
centos下設定ip位址 1 臨時修改 ifconfig eth0 192.168.100.100 route add default gw 192.168.100.1 dev eth0 1.3 修改dns echo nameserver 8.8.8.8 etc resolv.conf 這個時候就...
根據網絡卡所在的硬體介面設定IP位址
最近一直受到映象恢復作業系統後,網路連線名變化問題的困擾。當一台主機上有超過兩個網口的時候,經常會出現windows作業系統在自適應時,網路連線名不固定的問題。而網上諸多根據網路連線名來修改ip位址的方法就因此不是很可靠。經過一段時間的搜尋找到了用powershell可以獲得網絡卡硬體位址的 據此可...
設定本地網絡卡IP位址的批處理
這是乙個很好用的批處理命令集,可以設定自動獲得,可以手動設定,可以預先設定好後儲存。方案1 set a num 1 set project num 測試網路 set nname lan num 本地連線 set addr lan num 192.168.0.142 set mask lan num ...