Phase 5: AD role scripts, WinRM provisioning and lab wordlist

dc01 promotes the forest then runs a startup-scheduled post stage for OUs,
users, groups, the SPN on svc_backup, pre-auth disabled on j.contractor,
GenericAll over t.smith, the www A record, flags and advanced audit policy.
fs01 installs IIS, shares the web root's public/ as \\FS01\Public and joins.
ws01 joins, then adds WS Admins to local Administrators.

provision uploads over WinRM, starts scripts detached, waits on a .done
marker and survives the promotion reboot.
This commit is contained in:
2026-10-21 19:29:51 -04:00
parent a38acd3946
commit 279f4cc547
13 changed files with 2570 additions and 6 deletions
+40
View File
@@ -0,0 +1,40 @@
# Norbourg lab — WS01 stage 2: local privileges and the workstation flag.
. "$PSScriptRoot\..\lib\common.ps1"
$self = $PSCommandPath
Write-LabLog 'ws01: post stage starting'
try {
Wait-ForDomain 600
# svc_backup becomes a local admin through this domain group.
try {
Add-LocalGroupMember -Group 'Administrators' -Member '@@NETBIOS@@\WS Admins' -ErrorAction Stop
Write-LabLog 'ws01: WS Admins added to local Administrators'
} catch {
Write-LabLog 'ws01: WS Admins already local admin'
}
$flagDir = 'C:\flag'
New-Item -ItemType Directory -Force -Path $flagDir | Out-Null
$userFlag = Join-Path $flagDir 'user.txt'
if (-not (Test-Path $userFlag)) {
Set-Content -Path $userFlag -Value 'NORBOURG{w0rkst4t10n_l4t3r4l_m0v3}' -Encoding ascii
}
$acl = Get-Acl $flagDir
$acl.SetAccessRuleProtection($true, $false)
foreach ($id in @('BUILTIN\Administrators', 'NT AUTHORITY\SYSTEM')) {
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule(
$id, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
$acl.AddAccessRule($rule)
}
Set-Acl -Path $flagDir -AclObject $acl
Write-LabLog 'ws01: user.txt in place'
$null = schtasks.exe /Delete /TN 'NorbourgWsPost' /F
Complete-Stage $self 'ok'
} catch {
Fail-Stage $self $_.Exception.Message
}