感谢您使用微软产品。1。如果你的系统支持WMI,那么可以用下列代码实现(Win 2000下测试通过)改远程机器的IP地址(当前用户需要有足够的权限):
Dim obj As Object
Dim gateway As Variant
Dim GatewayCostMetric As Variant
Computer = "remotemachine"Set networkcards = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2").ExecQuery("Select * From Win32_NetworkAdapter Where AdapterType='Ethernet 802.3'")For Each mycard In networkcards WQL = "winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2:Win32_NetworkAdapterConfiguration=" & mycard.DeviceID
Set NIC = GetObject(WQL)
newIP = Array("10.11.12.5")
SubMask = Array("255.255.255.0")
NIC.EnableStatic newIP, SubMask
gateway = Array("10.11.12.1")
GatewayCostMetric = Array(1) ' from 1 to 9999
NIC.SetGateways gateway, GatewayCostMetric
Exit For 'Only change the default NIC
Next
2。改远程机器的名称:用NetRenameMachineInDomain API函数- 微软全球技术中心 VB开发支持 本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
Dim obj As Object
Dim gateway As Variant
Dim GatewayCostMetric As Variant
Computer = "remotemachine"Set networkcards = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2").ExecQuery("Select * From Win32_NetworkAdapter Where AdapterType='Ethernet 802.3'")For Each mycard In networkcards WQL = "winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2:Win32_NetworkAdapterConfiguration=" & mycard.DeviceID
Set NIC = GetObject(WQL)
newIP = Array("10.11.12.5")
SubMask = Array("255.255.255.0")
NIC.EnableStatic newIP, SubMask
gateway = Array("10.11.12.1")
GatewayCostMetric = Array(1) ' from 1 to 9999
NIC.SetGateways gateway, GatewayCostMetric
Exit For 'Only change the default NIC
Next
2。改远程机器的名称:用NetRenameMachineInDomain API函数- 微软全球技术中心 VB开发支持 本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
就是好用,谢谢!您是专业到这儿来解答问题的?太好了!