Como cambiar el DNS en un servidor mediante PowerShell
Knowledgebase |
En este artículo incluyo este script para cambiar los DNS en un servidor o equipo Windows mediante PowerShell, espero que os pueda ser de utilidad.
#----------------------------------------------------------------------------------
# Script for Windows Server 2016 and Windows Server 2012R2
# by Javier Sanchez Alcazar # Citrix CTP (2009-2016), Microsoft MVP(2011-2014) and Microsoft MVP Reconnect
# DNS Server change to Start logon
#--------------------------------------
Set-ExecutionPolicy Unrestricted
# Import modules
Import-Module Dism
Import-Module PSDesiredStateConfiguration
Import-Module WindowsErrorReporting
Import-Module ScheduledTasks
Import-Module CimCmdlets
Import-Module RemoteDesktop
Import-Module ServerManager
#--------------------------------------------------------------------------------------------------
# Variable definition
#--------------------------------------------------------------------------------------------------
#
# Read the Network configuration for apply changes
$nic = Get-WmiObject Win32_NetworkAdapterConfiguration -filter "ipenabled = 'true'"
#
#--------------------------------------------------------------------------------------------------
# End variable definition
#--------------------------------------------------------------------------------------------------
Write-Host "-------------------------------------------------------------"
Write-Host "Server DNS Change process"
Write-Host "-------------------------------------------------------------"
$DNS1="192.10.20.1","192.10.20.2"
$dns = $DNS1 $nic.SetDNSServerSearchOrder($dns)
Write-Host "Network configuration is Modified"
#--------------------------------------------------------------------------------------------------
# End of Code/PowerShell
#--------------------------------------------------------------------------------------------------
Últimas noticias
- Hotfix XS82ECU1060 - For Citrix Hypervisor 8.2 Cumulative Update 1
- Citrix Hypervisor Security Bulletin for CVE-2023-46838
- Lo siguiente de Citrix Virtual Apps and Desktop LTSR
- CITRIX USER GROUP ESPAÑA
- Reactivamos
- Vulnerabilidad en la aplicación MOVEit / NetScaler
- Cómo instalar Hyper-V en Windows Home
- Solución: No aparece la opción de “Virus & Threat protection”