squatchulator / Capstone

This is the repository for my Capstone senior project for Champlain College.
1 stars 0 forks source link

Implement AD OU Infrastructure #64

Open squatchulator opened 5 months ago

squatchulator commented 5 months ago

Servers were both activated with Windows Server 2022 keys on 4/12/2024

Roles and Features: (Roles) Active Directory Domain Services DHCP Server DNS Server File and Storage Services |_File Server |_DFS Replication |_File Server Resource Manager (Features) Enhanced Storage Failover Clustering Failover Clustering Tools |_Failover Clustering Management Tools Storage Replica Windows Server Backup

New forest (Made on DC1): generator.local

After rebooting for Roles and Features install, promote to DC and reboot again Go into ADUC and in Users, rename Administrator to lcadmin Delete Managed Users container Create the Generator and LeahyCenter local admin users (in settings) |_Accounts are members of:

OU Structure:

TPM entries to make: DC1 and DC2 local admin (LeahyCenter account) Leahy Center Domain Admin (lcadmin account) DC1 and DC2 Generator Staff local admin (Generator account) Generator Staff Domain Admin (genadmin account)

Disk 0 is formatted to take up the whole drive. It is assigned the letter D:\ and is named Backups. Disk 1 is formatted to take up the whole drive. It is assigned the letter E:\ and is named Files. After formatting it in Windows Server Backup, go back into the disk editor and assign it a drive letter again so our script can see it. Backups are sent to Disk 0. This drive will be reserved for this purpose on each server. Backups are scheduled to occur daily at 9pm. In order to automatically delete old backups after a certain period of time, we need to make a .ps1 script that is executed to do so via Task Schedueler. This script is kept on the C:\ drive under a folder called "Process Scripts". It is titled "BackupRotate.ps1". The script contains the following:

$backupFolder = "D:\WindowsImageBackup\GEN-DC1" (or DC-2) # Specify the path to the folder containing backups
$thresholdDays = 15                       # Specify the number of days to keep backups

# Calculate the date threshold
$thresholdDate = (Get-Date).AddDays(-$thresholdDays)

# Get backup folders older than the threshold date and containing the word "Backup"
$oldBackupFolders = Get-ChildItem -Path $backupFolder -Directory | Where-Object { $_.Name -like "*Backup*" -and $_.CreationTime -lt $thresholdDate }

# Delete old backup folders
foreach ($folder in $oldBackupFolders) {
    Remove-Item $folder.FullName -Recurse -Force
}

To make the task, open Task Schedueler and make a New Task named "BackupRotate". Create a new trigger on a scheduele that executes daily at midnight. Create a new action - select Start a program, hit browse, and select your .ps1 script.