Skip to content

Commit

Permalink
Reapply "fix(ame bug): mount reg hives manually #1163"
Browse files Browse the repository at this point in the history
This reverts commit be88113.
  • Loading branch information
he3als committed Oct 6, 2024
1 parent c129af1 commit a4890b1
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 a4890b1

Please sign in to comment.