Skip to content

Commit

Permalink
fix(ame bug): mount reg hives manually #1163
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Oct 5, 2024
1 parent 3b646b7 commit 8c329b5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/playbook/Configuration/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
title: Root Playbook File
description: Runs all of the Playbook files
actions:
# AME Wizard seemingly has a bug where it doesn't mount other user's Registry hives
- !writeStatus: {status: 'Preparing Hives'}
- !powerShell:
command: |
$profileList = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name 'ProfilesDirectory', 'Default' -EA 0
$usersPath = if ([string]::IsNullOrEmpty($profileList.ProfilesDirectory)) { """$env:SystemDrive\Users""" } else { $profileList.ProfilesDirectory }
$defaultPath = if ([string]::IsNullOrEmpty($profileList.Default)) { """$usersPath\Default""" } else { $profileList.Default }
$count = 1
$prefix = 'HKU\AME_UserHive_'
foreach ($hive in (Get-ChildItem -Path $usersPath -Force -Depth 1 | ? { $_.Name -eq 'NTUSER.DAT' })) {
if (!$defaultFound -and ($hive.Directory.FullName -eq $defaultPath)) {
$defaultFound = $true
$name = """$prefix""" + """Default"""
} else {
$name = """$prefix""" + """$count"""
}
Write-Output """`nMounting $($hive.Directory.Name):"""
reg load """$name""" """$($hive.FullName)"""
}
weight: 10
wait: true

- !writeStatus: {status: 'Copying files'}
- !powerShell:
command: |
Expand Down

0 comments on commit 8c329b5

Please sign in to comment.