VBS 获取本机IP地址、IE版本

'获取本机 IP地址
Function GetLocalIP(ComputerName)
Dim objWMIService,colItems,objItem,objAddress
Set objWMIService = GetObject("winmgmts://" & ComputerName & "/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
ForEach objItem in colItems
    ForEach objAddress in objItem.IPAddress
    If objAddress <> ""then
    GetIPMAC = objAddress
    EndIf
    ExitFor
    Next
ExitFor
Next
a=Msgbox(GetIPMAC)
EndFunction

GetLocalIP(".")


'获取本机 IE版本   (源:null错误待验证,即将更新……)
Set objwmiserviceIE=GetObject("winmgmts:\" & strComputer & "\root\cimv2\Applications\MicrosoftIE")
Set colIESettings=objwmiserviceIE.execquery("select * from MicrosoftIE_Summary")
ForEach strIESetting In colIESettings
    MsgBox"IE version: "&strIESetting.version
    MsgBox strIESetting.productID
Next

你可能感兴趣的:(VBScript)