Deploy Windows Core Server 2022 with Server Core App Compatibility Feature on Demand with Packer

I while ago I started with parker to create simple templates for use in my homelab.

It take some time to find the rights scripts and learning en understanding the HCL2 coding

But in related to Security reasons I want to use a Windows Core Server the smaller footprint.

What is Server Core App Compatibility Feature on Demand: https://learn.microsoft.com/en-us/windows-server/get-started/server-core-app-compatibility-feature-on-demand

Installing Features on Demand through Powerschell contains a bug. You may see “failure to download files”, “cannot download”, or errors like “0x800F0954” or file not found.

To Solve that I created I powerschell script to run the install twice: featuresondemand.ps1

You can find al the needed files on my Public Github Packer repository: https://github.com/WardVissers/Packer-Public

When running is showing like this:

A blue screen with white squares

Description automatically generated

It works for now, but there is one thing that would the hole thing a quiet nicer.
Passwords encrypted in a separate file.

Windows 2008 Core Read Only Domain Controller Script

1. Enter the productkey:
slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

2. Activate:
slmgr.vbs -ato

3. Show activation:
slmgr.vbs -dli

4. Rename the computer:
Netdom renamecomputer WIN-???????? /newname:W2K8RDC01 /reboot:15
(use the command set to view all the variables used by Microsoft Windows)

5. Show all network interfaces:
Netsh interface ipv4 show interface

6. Set a static IP address:
Netsh interface ipv4 set address name=2 source=static address=xxx.xxx.xxx.xxx mask=255.255.255.0 gateway=xxx.xxx.xxx.xxx
(make sure that you’re choosing the right network interface. In this example it’s 2, so name=2 it means interface 2)

7. Set a static DNS server:
Netsh interface ipv4 add dnsserver name=2 address=xxx.xxx.xxx.xxx index=1

8. Turn Remote Desktop (RDP) on:
Cscript %windir%system32SCRegEdit.wsf /ar 0

9. Enable Remote Desktop (RDP) in the Windows Firewall:
netsh advfirewall firewall set rule group=”remote desktop” new enable=yes

10. Enable Remote Management (RemoteCMD) in the Windows Firewall:
netsh firewall set service type=remoteadmin mode=enable 

11. Join the domain:
Netdom join W2K8RDC01 /domain:adtest.local /usero:administrator /passwordo:*
(This step is only for joining a member server to the domain. For a Domain Controller go to step 12)

12. Preparing the promotion to a Read Only Domain Controller:
We need to create a unattend.txt that we are going to use by the DCPROMO. So let’s create a new textfile, type notepad

13. Making the unattended.txt:
Copy and past the following test into the new textfile and save this file on the C: drive of the Core Server.

==================================================
[DCInstall]
InstallDNS=Yes
ConfirmGc=Yes
CriticalReplicationOnly=No
DisableCancelForDnsInstall=No
RebootOnCompletion=Yes
ReplicaDomainDNSName=adtest.local
ReplicaOrNewDomain=ReadOnlyReplica
ReplicationSourceDC=win2k8dc01.adtest.local
SafeModeAdminPassword=******************
SiteName=Default-First-Site-Name
UserDomain=adtest.local
UserName=administrator
Password=******************
RebootOnCompletion=Yes
==================================================
14) Run the DCPROMO
dcpromo /unattend:c:unattend.txt

Windows 2008 Core Configurator Download

 

Ik vond een nice tooltje om Windows Core mee te configureren. Het tootlje is gemaakt door voormalig MVP Guy Teverovsky. Het tooltje heet dan ook Core Configurator.
Hij geeft dit tooltje gemaakt in prive tijd maar dit heeft dit van zijn voormalige werkgever of line moeten halen. Zie het verhaal hier.

Hoezo voor malig MVP: Hij heeft zijn MVP Titel moeten inleveren toen hij voor Microsoft ging werken in Isreal.

Downloaden:
CoreConfigurator.cab
Coreconfigurator.zip

En zo ziet het tooltje er uit:
coreconfigurator

Translate »