Chestii interesante - scripturi Visual Basic - p1 (vb)

  1. Option Explicit
  2. Dim objWMIService
  3. Dim objNetAdapter
  4. Dim strComputer
  5. Dim arrIPAddress
  6. Dim arrSubnetMask
  7. Dim arrGateway
  8. Dim colNetAdapters
  9. Dim errEnableStatic
  10. Dim errGateways

  11. strComputer = "."
  12. arrIPAddress = Array("xxx.xxx.xxx.xxx")
  13. arrSubnetMask = Array("xxx.xxx.xxx.xxx")
  14. arrGateway = Array("xxx.xxx.xxx.xxx")
  15. Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  16. Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
  17. For Each objNetAdapter in colNetAdapters
  18. errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress, arrSubnetMask)
  19. errGateways = objNetAdapter.SetGateways(arrGateway)
  20. Next
 Prima pagina |  Adaugat de ddumi (329 vizualizari) |  Text format (download) |  Sursa cod/script