0
私はコンピュータ名を表示する簡単なスクリプトを作成しようとしている
を一覧表示するには、ユーザー名、IPアドレス、およびイーサネットインタフェース(有線)の名前をログに記録し、それはMACです:VBSスクリプトは、インターフェースとMAC
intCount = 0
strMAC = ""
' We're interested in MAC addresses of physical adapters only
strQuery = "SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID > ''"
Set objWMIService = GetObject("winmgmts://./root/CIMV2")
Set colItems = objWMIService.ExecQuery(strQuery, "WQL", 48)
For Each objItem In colItems
If objItem.AdapterType = "Ethernet 802.3" then
If InStr(strMAC, objItem.MACAddress) = 0 Then
strMAC = strMAC & ", " & objItem.MACAddress
Name = objItem.Name & vbCRLF
intCount = intCount + 1
End If
End If
Next
' Remove leading comma
If intCount > 0 Then strMAC = Mid(strMAC, 2)
dim NIC1, Nic, StrIP, CompName
Set NIC1 =
GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
For Each Nic in NIC1
if Nic.IPEnabled then
StrIP = Nic.IPAddress(i)
Set WshNetwork = WScript.CreateObject("WScript.Network")
Dim objNetwork
Set objNetwork = CreateObject("WScript.Network")
CompName = WshNetwork.Computername
Dim WMI, Configs, Config, Adapters, Adapter
Set WMI = GetObject("winmgmts:{impersonationlevel=impersonate}root/cimv2")
strUserName = wshNetwork.UserName
MsgBox "IP Adres: "&StrIP & vbNewLine _
& "Computer Name: "&CompName & vbNewLine _
& "Login: "&strUserName & vbNewLine _
& "Interface and MAC: "& Name, & strMAC ,4160,"Information about IP"
wscript.quit
end if
next
が、それはです誰も私を助けることができるだろうか?