איך להוסיף שלט דומיין לדומיין קיים (PowerShell)

כיצד ניתן להוסיף בקר דומיין (DC) חדש לדומיין ה־Active Directory (AD) הקיים שלכם? בפוסט זה אני אראה לכם כיצד להוסיף בקר DC חדש ל־AD.

מאמר זה חל על: Windows Server 2025, Windows Server 2019, Windows Server 2022 ו־Windows Server 2016

בדוק את רמת הפונקציונליות של הדומיין והיער

הדרישה העיקרית היחידה להוספת בקר דומיין של Windows Server 2025 לדומיין קיים היא שרמת הפונקציונליות של הדומיין צריכה להיות ברמת Windows Server 2016. אני יכול להשתמש ב־PowerShell כדי לוודא את רמת הפונקציונליות של הדומיין והיער.

Get-ADForest | fl Name, ForestMode
Get-ADDomain | fl Name, DomainMode
Using PowerShell to confirm the forest and domain functional levels

התקן את Windows Server ושנה את שם השרת

ההתקנה הראשונית כוללת הפעלת מכונה וירטואלית חדשה והתקנת Windows Server. כאשר ההתקנה מסתיימת, אני יכול להשתמש בפקודת PowerShell זו כדי לשנות את שם המחשב.

Rename-Computer -NewName "WS25-DC5" -Restart

בדוק עדכונים באמצעות SConfig

לאחר האתחול מחדש, אני יכול להשתמש בתוכנת 'SConfig' ב־PowerShell כדי לבדוק עדכונים ולהתקין אותם. (העדכונים כבר מותקנים, כך שאין עדכונים ממתינים)

Using SConfig to check for and install Windows Updates

לאחר אתחול נוסף, עלינו להקצות כתובת IP סטטית לשרת שלנו. הנה הפקודות.

New-NetIPAddress –IPAddress 192.168.1.138 -DefaultGateway 192.168.1.254 -PrefixLength 24 -InterfaceIndex (Get-NetAdapter).InterfaceIndex

Set-DNSClientServerAddress –InterfaceIndex (Get-NetAdapter).InterfaceIndex –ServerAddresses 192.168.1.240,192.168.1.241

This will assign a static IP of 192.168.1.38 on my lab network with the default gateway and add my first two DCs as DNS servers. We will need this when we join the computer to the domain next.

All set to join to AD and promote to DC

Join Windows Server to the Active Directory domain

The next step is to join the computer to my AD domain – reinders.local. Let’s use this command to handle the process in one step.

Add-Computer -DomainName "reinders.local" -Restart
Using PowerShell to join my server to my domain

Install the AD DS server role

After a reboot, I’ll log in to the server with my domain admin account (mreinders). We are ready – we can first run this command to install the Active Directory Domain Services (ADDS) role.

Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
Installing the AD Domain Services role with PowerShell

Promote the server to a domain controller

With this complete, we can run this command to promote the server to a DC.

Install-ADDSDomainController -DomainName "reinders.local" -InstallDns -Credential (Get-Credential) -Confirm:$false

One quick note – I need to temporarily add my domain admin account to the Enterprise Admins group to allow this change. Check out Manage Active Directory Groups Using PowerShell on Petri.com to add your account to the Enterprise Admins group.

Windows is configuring the server to be a DC

לאחר שהושלמה התהליך, Windows הציעה לי לאתחל.

After that is complete, we need to reboot. Notice the AD schema version was updated…

לאחר אתחול נוסף, הכל בסדר. אני יכול להשתמש ב-PowerShell כדי לאשר שיש לנו 5 DCs.

Get-ADDomainController -Filter * | Select-Object Name, IPv4Address, OperatingSystem

תודה על קריאת הפוסט שלי על הוספת שרת Windows Server כשרת בקרון דומיין חדש בתחום AD קיים.

Source:
https://petri.com/add-domain-controller-to-existing-domain-powershell/