# Installation

## Setup DNS

```powershell
# Install normal DNS server
Install-WindowsFeature DNS

# Register DNS records
cmd /c ipconfig -registerdns
```

## Install AD DS on Server Core

```powershell
# Install AD DS and management tools
Install-WindowsFeature -Name ad-domain-services -IncludeManagementTools

# Install new forest and domain
Install-ADDSForest -DomainName "lab.local"
```

## Add Domain Controller

```powershell
# Add domain controller and prompt for credentials
Install-ADDSDomainController -DomainName "lab.local" -Credential (Get-Credential Lab\Administrator)
```

### Create DC from IFM Media

```
" Create directory for image
mkdir C:\ifm

" Launch ntdsutil
ntdsutil
ntdsutil: activate instance ntds
ntdsutil: ifm
ifm: create sysvol full c:\ifm
```

Transfer folder to target computer then run

```powershell
Install-ADDSDomainController -DomainName "lab.local" -Credential (Get-Credential Lab\Administrator) -InstallationMediaPath "C:\ifm"
```

### Clone DC

```powershell
# Get list of applications that do not support cloning
Get-ADDCCloningExcludedApplicationList

# Create list of applications that do support cloning
Get-ADDCCloningExcludedApplicationList -GenerateXml

# Create config file
New-ADDCCloneConfigFile -Static -IPv4Address "192.168.47.13" -IPv4DNSResolver "192.168.47.10" -IPv4SubnetMask "255.255.255.0" -CloneComputerName "DC04" -IPv4DefaultGateway "192.168.47.2"

# Shutdown computer and clone VM
Stop-Computer
```

## Join Computer To Domain

```powershell
# Add computer to domain and restart
Add-Computer -DomainName "lab.local" -Restart

# Rename computer and add to domain
Add-Computer -DomainName "lab.local" -NewName "test" -Restart
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.bufu-sec.com/active-directory/general/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
