时间:2021-05-22
描述信息
用以返回配置数据(类似于IPCONFIG命令返回信息)的WMI脚本。
脚本代码
复制代码 代码如下:
'ReturningIPConfigurationData
'WMIscriptthatreturnsconfigurationdatasimilartothatreturnedbyIpConfig.
strComputer="."
SetobjWMIService=GetObject("winmgmts:\\"&strComputer&"\root\cimv2")
SetcolAdapters=objWMIService.ExecQuery_
("SELECT*FROMWin32_NetworkAdapterConfigurationWHEREIPEnabled=True")
n=1
WScript.Echo
ForEachobjAdapterincolAdapters
WScript.Echo"NetworkAdapter"&n
WScript.Echo"================="
WScript.Echo"Description:"&objAdapter.Description
WScript.Echo"Physical(MAC)address:"&objAdapter.MACAddress
WScript.Echo"Hostname:"&objAdapter.DNSHostName
IfNotIsNull(objAdapter.IPAddress)Then
Fori=0ToUBound(objAdapter.IPAddress)
WScript.Echo"IPaddress:"&objAdapter.IPAddress(i)
Next
EndIf
IfNotIsNull(objAdapter.IPSubnet)Then
Fori=0ToUBound(objAdapter.IPSubnet)
WScript.Echo"Subnet:"&objAdapter.IPSubnet(i)
Next
EndIf
IfNotIsNull(objAdapter.DefaultIPGateway)Then
Fori=0ToUBound(objAdapter.DefaultIPGateway)
WScript.Echo"Defaultgateway:"&objAdapter.DefaultIPGateway(i)
Next
EndIf
WScript.Echo
WScript.Echo"DNS"
WScript.Echo"---"
WScript.Echo"DNSserversinsearchorder:"
IfNotIsNull(objAdapter.DNSServerSearchOrder)Then
Fori=0ToUBound(objAdapter.DNSServerSearchOrder)
WScript.Echo""&objAdapter.DNSServerSearchOrder(i)
Next
EndIf
WScript.Echo"DNSdomain:"&objAdapter.DNSDomain
IfNotIsNull(objAdapter.DNSDomainSuffixSearchOrder)Then
Fori=0ToUBound(objAdapter.DNSDomainSuffixSearchOrder)
WScript.Echo"DNSsuffixsearchlist:"&objAdapter.DNSDomainSuffixSearchOrder(i)
Next
EndIf
WScript.Echo
WScript.Echo"DHCP"
WScript.Echo"----"
WScript.Echo"DHCPenabled:"&objAdapter.DHCPEnabled
WScript.Echo"DHCPserver:"&objAdapter.DHCPServer
IfNotIsNull(objAdapter.DHCPLeaseObtained)Then
utcLeaseObtained=objAdapter.DHCPLeaseObtained
strLeaseObtained=WMIDateStringToDate(utcLeaseObtained)
Else
strLeaseObtained=""
EndIf
WScript.Echo"DHCPleaseobtained:"&strLeaseObtained
IfNotIsNull(objAdapter.DHCPLeaseExpires)Then
utcLeaseExpires=objAdapter.DHCPLeaseExpires
strLeaseExpires=WMIDateStringToDate(utcLeaseExpires)
Else
strLeaseExpires=""
EndIf
WScript.Echo"DHCPleaseexpires:"&strLeaseExpires
WScript.Echo
WScript.Echo"WINS"
WScript.Echo"----"
WScript.Echo"PrimaryWINSserver:"&objAdapter.WINSPrimaryServer
WScript.Echo"SecondaryWINSserver:"&objAdapter.WINSSecondaryServer
WScript.Echo
n=n+1
Next
FunctionWMIDateStringToDate(utcDate)
WMIDateStringToDate=CDate(Mid(utcDate,5,2)&"/"&_
Mid(utcDate,7,2)&"/"&_
Left(utcDate,4)&""&_
Mid(utcDate,9,2)&":"&_
Mid(utcDate,11,2)&":"&_
Mid(utcDate,13,2))
EndFunction
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
使用函数查询数据库遍历实现?12345678910111213141516171819202122232425262728/***不在常用ip地址登录返回描红信
程序主要是读取这个网站的iis日志,分析出其中的IP地址,用安全策略自动封闭。VBS代码如下:复制代码代码如下: '代码开始 Setfileobj=Crea
用以返回配置数据(类似于IPCONFIG命令返回信息)的WMI脚本。'ReturningIPConfigurationData'WMIscriptthatret
实例01实现一个简单的Web服务访问本实例将实现IP地址查询接口服务,根据用户传入的IP地址返回IP所在的省、市、地区,实例中将会用到IP地址库用于查询信息,由
用Promise来实现function2(){//你的逻辑代码returnPromise.resolve()}function3()