Have a Question?
PS | Initial Setup for New Windows Server
Refer to the PowerShell Script below on how to perform initial setup for new Windows Server
Timezone
Set Timezone to Malaysia
$TimeZone = "Malay Peninsula Standard Time"
Set-TimeZone -Name $TimeZone
IPv4 priority over IPv6
#Pefer IPv4 over IPv6
New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" -Name DisabledComponents -Value 0x20 -PropertyType Dword
Enable Remote Desktop
#Enable Remote Desktop
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
Firewall Rules
Refer to Manage Windows Firewall with PowerShell for more detail information
#Allow Ping
New-NetFirewallRule -DisplayName "Allow inbound ICMPv4" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -Action Allow
#Allow inbound RDP
Set-NetFirewallRule -DisplayGroup "Remote Desktop" -Enabled True
#File Sharing - Optional
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True
Static IP Address & DNS Server
$Interface = "ethernet0"
$IPv4 = "192.168.1.230"
$Prefix = "24"
$DefaultGateway = "192.168.1.1"
$DNSServer = "192.168.1.230"
#Change IP Address
New-NetIPAddress -InterfaceAlias $Interface -IPAddress $IPv4 -PrefixLength $Prefix -DefaultGateway $DefaultGateway
#DNS Client
Set-DnsClientServerAddress -InterfaceAlias $Interface -ServerAddresses $DNSServer
Windows Update
Refer to Manage Windows Update with PowerShell for more detail information
#WindowsUpdate
Install-Module PSWindowsUpdate
Install-WindowsUpdate -AcceptAll -Install -IgnoreReboot | Out-File "c:\Logs\$(get-date -f yyyy-MM-dd)-WindowsUpdate.log" -force
PowerShell as Default Shell
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name Shell -Value 'PowerShell.exe -NoExit'
Minimal GUI
Install Windows Server 2019 Core Feature on Demand for App Compatibility to have additional GUI Tool for management in Server Core
Download App Compatibility FOD from Microsoft Volume License Site
Upload the ISO file to C:\Temp\FOD.iso on Windows 2019 Server Core and install it
Mount-DiskImage -ImagePath C:\temp\FOD.ISO
#Install
Add-WindowsCapability -Online -Name ServerCore.AppCompatibility~~~~0.0.1.0 -Source:E: -LimitAccess
#Reboot once completed
Restart-Computer
Additional GUI Tool, like Group Policy Management can be used in Server Core now.