Initial configuration of member (non-DC) servers running Server 2016

The following scripts help automate the initial configuration of Server 2016 for member servers. See the scripts for documentation.

Configures the time zone, IP information, removes SMB 1 support, renames the computer, and joins the domain.
This script can be used as soon as a new member server running Server 2016 has been created. First, the
time zone is set. Next, the script prompts for an IP address and sets the IP information for the computer.
Then, the Windows Feature SMB 1 Support is removed. Finally, the script prompts for a computer name and
joins the domain and renames the computer.
This will prompt for the network adapter to set the IP on, the desired IP, and the computer name while it is running.
Author: Eric Claus
Date: June 15, 2017       
## Set time zone
Set-TimeZone "Eastern Standard Time"
## Set Static IP
echo "Select the InterfaceAlias of the network adapter you would like to set the IP for."
# Display current network adapters and their IP addresses
$myNIC = Get-NetIPAddress | Select InterfaceAlias,IPAddress | Out-GridView -Title "Please select an InterfaceAlias and press OK"-OutputMode Single
$myNIC = $myNIC.InterfaceAlias
$myIP = Read-Host "Type an IP address to give $myNIC (eg. 192.168.10.x)"
$myCIDR = "24"
$myDG = ""
$myDNS1 = ""
$myDNS2 = ""
# Check if the selected IP address already exists (is pingable)
if (Test-Connection $myIP -Count 1 -ErrorAction 0) {echo "`nError: IP address already existson the network.`n";pause;exit}
echo "Setting the IP address of $myNIC to $myIP with subnet mask /$myCIDR, with default gateway $myDG, and with DNS servers $myDNS1, $myDNS2"
# Actually set the IP
Remove-NetIPAddress -InterfaceAlias $myNIC
Remove-NetRoute -DestinationPrefix ""
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress $myIP -PrefixLength $myCIDR -DefaultGateway $myDG
Set-DnsClientServerAddress -InterfaceAlias $myNIC -ServerAddresses $myDSN1, $myDNS2
## Remove SMB 1 support feature
echo "Removing SMB 1.0 File Sharing Support Feature (Thanks, NSA)"
Remove-WindowsFeature FS-SMB1
## Join the domain and rename the computer
$myComputerName = Read-Host "What would you like to set the computer name to?"
$myDomain = ""
$myOU = "OU=Mem_Svrs,DC=ad,DC=domain,DC=com"
echo "Joining the domain: $myDomain and naming the computer: $myComputerName"
echo "Adding the computer to the OU: $myOU"
Add-Computer -DomainName $myDomain -OUPath $myOU -NewName $myComputerName -Restart
  • servers/svr_2016_initial_config.txt
  • Last modified: 2019/03/15 18:32
  • by ericclaus