Skip to content

Instantly share code, notes, and snippets.

@epjuan21
Created March 29, 2022 16:09
Show Gist options
  • Save epjuan21/75c2399e038443a7d500009b7764b9d9 to your computer and use it in GitHub Desktop.
Save epjuan21/75c2399e038443a7d500009b7764b9d9 to your computer and use it in GitHub Desktop.
Configurar IP y DNS
########################################################
### ###
### Prerrequisitos Instalacion Directorio Activo ###
### ###
########################################################
### __ Identificar Tarjeta de Red Principal ___ ###
### _______________________________________________ ###
## ----------------------------------------------
## Usar el Comando Get-NetAdapter
## ----------------------------------------------
##
## Variables Tarjeta de Red
## ______________________________________________
$AliasTarjetaDeRedActual = "Ethernet 1"
$AliasTarjetaDeRedNuevo = "LAN"
### __ Cambiar nombre del Adaptador de Red ___ ###
### _______________________________________________ ###
Get-NetAdapter -Name $AliasTarjetaDeRedActual | Rename-NetAdapter -NewName $AliasTarjetaDeRedNuevo -PassThru
### __ Cambiar Direccionamiento IP ___ ###
### _______________________________________________ ###
##
## Variables Direccionamiento IP
## ______________________________________________
$IpAdress = "192.168.1.100"
$DefaultGateway = "192.168.1.254"
# Para ello debemos tener el nombre o el alias que pusimos a la tarjeta de red en el paso anterior
New-NetIPAddress -InterfaceAlias $AliasTarjetaDeRedNuevo -IPAddress $IpAdress -PrefixLength 24 -DefaultGateway $DefaultGateway
# Cambiar Direcciones DNS
Set-DnsClientServerAddress -InterfaceAlias $AliasTarjetaDeRedNuevo -ServerAddresses $IpAdress, $DefaultGateway
### __ Deshabilitar IPv6 ___ ###
### _______________________________________________ ###
Disable-NetAdapterBinding -Name $AliasTarjetaDeRedNuevo -ComponentID ms_tcpip6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment