用vbs實(shí)現(xiàn)配置靜態(tài) IP 地址
更新時(shí)間:2007年05月14日 00:00:00 作者:
將計(jì)算機(jī)的 IP 地址設(shè)置為 192.168.1.141,并將 IP 網(wǎng)關(guān)設(shè)置為 192.168.1.100。
腳本代碼
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
腳本代碼
復(fù)制代碼 代碼如下:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
相關(guān)文章
利用VBS發(fā)送短信的實(shí)現(xiàn)代碼(通過(guò)飛信)
無(wú)意中看到百度 VBS 貼吧里一個(gè)標(biāo)題為《無(wú)私的奉獻(xiàn)出我的用飛信免費(fèi)發(fā)短信接口》的帖子。2011-08-08
vbscript logparser的ISA2004 Web流量報(bào)告
由于ISA2004自帶的report不能滿足他們的要求,所以我寫了這個(gè)腳本,用來(lái)生成報(bào)告。使用前請(qǐng)先閱讀readme.txt2009-03-03
用vbs來(lái)探測(cè)端口的代碼 不用注冊(cè)winsock
寫這東東主要是在木馬的cmdshell中用,探測(cè)目標(biāo)ip的常用端口是否開放。像用nc在shell中返回信息不方便,其它掃描軟件什么的tcp syn之類的掃描怕動(dòng)靜太大2011-05-05
利用WScript.Shell對(duì)象隱藏cmd命令行運(yùn)行框的實(shí)現(xiàn)代碼
利用WScript.Shell對(duì)象隱藏cmd命令行運(yùn)行2009-12-12
vbs qq自動(dòng)發(fā)信息增強(qiáng)版
這篇文章主要介紹了vbs qq自動(dòng)發(fā)信息增強(qiáng)版,需要的朋友可以參考下2014-05-05

