GSerg писал(а):Приведи пример ситуации, когда это необходимо.
Private Sub set_ip()
strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration " _
& "where IPEnabled=TRUE")
strIPAddress = Array("ip адрес")
strSubnetMask = Array("маска")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableStatic( _
strIPAddress, strSubnetMask)
Next
End Sub
Private Sub set_gateways()
strComputer = "."
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objNetCard In colNetCards
arrGateways = Array("шлюз")
objNetCard.SetGateways (arrGateways)
Next
End Sub
Сейчас этот форум просматривают: AhrefsBot, Majestic-12 [Bot] и гости: 95