Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Configurare indirizzo IP da file batch

    Salve a tutti,
    come da topic è possibile modificare l'indirizzo IP di una interfaccia di rete tramite file batch?

  2. #2
    Utente di HTML.it L'avatar di fabio309
    Registrato dal
    Oct 2002
    Messaggi
    1,918
    con questo script puoi cambiare le impostazione di rete di un pc
    codice:
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    
    Set colNetAdapters = objWMIService.ExecQuery _
        ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
    
    strIPAddress = Array("192.168.1.141")
    strSubnetMask = Array("255.255.255.0")
    strGateway = Array("192.168.1.100")
    strGatewayMetric = Array(1)
     
    For Each objNetAdapter in colNetAdapters
        errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
        errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
        If errEnable = 0 Then
            WScript.Echo "The IP address has been changed."
        Else
            WScript.Echo "The IP address could not be changed."
        End If
    Next
    copi e salvi come *.vbs

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.