For some KTSI projects I have been working a lot with Windows Server Core or Hyper-V Server. Now I had to do a lot of automation, so I made this little connection of commands. If you configure the server manually you can do the most important things with the sconfig utility.
Networking
Set Hostname
netdom renamecomputer %COMPUTERNAME% /NewName:<NewComputerName>
Join Domain
netdom join %COMPUTERNAME% /domain:<DomainName> /userd:<UserName> /passwordd:*
Remove Domain
netdom remove
Rename Network Interface
netsh interface set interface name=”old name” newname=”new name”
Configure IP Address
netsh interface ipv4 set address name=”<Interface Name>” source=static address=<IPAddress> mask=<SubnetMask> gateway=<DefaultGateway>
Configure DNS Servers
netsh interface ipv4 add dnsserver name=”<Interface Name>” address=<DNS Server IP> index=1
Disable Firewall (not recommended)
netsh advfirewall set allprofiles state off
Remoting
Enable PowerShell Remoting
Enable-PSRemoting
Enable Remotedesktop
netsh advfirewall firewall set rule group=”remote desktop” new enable=yes
Enable Remote Administration
advfirewall firewall set rule group=”Remote Administration” new enable=yes
Enable Remote Firewall Administration
netsh advfirewall firewall set rule group=”Windows Firewall Remote Management” new enable=yes
Enable ICMP (Ping)
netsh firewall set icmpsetting 8
Enable Remote Disk Management
netsh advfirewall firewall set rule group=”Remote Volume Management” new enable=yes
Licensing
Enter License key
slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Activate Windows
slmgr.vbs -ato
Windows Update
Enable automatic updates
cscript C:'Windows'System32'Scregedit.wsf /au 4
Disable automatic updates
cscript C:'Windows'System32'Scregedit.wsf /au 1
Roles & Features
Get availibale features & roles
Dism /online /get-features /format:table
Enable feature & roles
Dism /online /enable-feature /featurename:<featurename>
Basics
Change Administrator password
net user administrator *
Restart Computer
shutdown /r /t 0
Logoff
logoff
More information about Server Core: TechNet
Tags: cmd, command, commandline, Core Server, Hyper-V, Hyper-V Server, KTSI, Microsoft, PowerShell, sconfig, Windows Server, Windows Server Core Last modified: August 18, 2018
Good Day!
Awesome post on Server Core & Hyper-V core commands.
Everyone is always looking for this.
Keep up the good work!
Cheers.
Good post, thanks.
Do these commands only work with windows server 2016 and above only? I’m trying them on windows server 2012 R2 standard core but I’m getting an error that “an ampersand is a reserved word”.
They should also work with Windows Server 2008. I wrote this in 2011 :)