2
我有一個要求,以獲得我使用下面的操作的方式從VBS PC的IP地址:獲取IP,然後改變最後一個字節
strQuery = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE MACAddress > ''"
Set objWMIService = GetObject("winmgmts://./root/CIMV2")
Set colItems = objWMIService.ExecQuery(strQuery, "WQL", 48)
For Each objItem In colItems
If IsArray(objItem.IPAddress) Then
If UBound(objItem.IPAddress) = 0 Then
strIP = "IP Address: " & objItem.IPAddress(0)
Else
strIP = "IP Addresses: " & Join(objItem.IPAddress, ",")
End If
End If
Next
我然後使用下面的映射網絡驅動器:
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUser, strPassword, strProfile
strDriveLetter = "Z:"
strRemotePath = "\\10.121.34.140\c$"
strUser = "user"
strPassword = "Password"
strProfile = "false"
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, _
strProfile, strUser, strPassword
我想不過做的是獲得hostmachine(所以10.121.34.130
)的知識產權和公正的八位位組更改爲.140
,並映射到這一點。
我該怎麼做?
完美 - 我調整,使帶材MyIPAddress和它的作品 - 很多謝謝! – Qazxswe