Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few errors during image cleanup #143

Open
eugenesan opened this issue Apr 24, 2024 · 1 comment
Open

A few errors during image cleanup #143

eugenesan opened this issue Apr 24, 2024 · 1 comment

Comments

@eugenesan
Copy link
Contributor

I've noticed a few errors during image cleanup:

Disabling Teams:
DEBUG:  168+  >>>> & 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications' '/v' 'ConfigureChatAutoInstall' '/t' 'REG_DWORD' '/d' '0'
'/f'
ERROR: Access is denied.
DEBUG:  196+  >>>> & 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps' '/f'
ERROR: The system was unable to find the specified registry key or value.
DEBUG:  210+  >>>> reg unload HKLM\zDRIVERS
ERROR: The parameter is incorrect.
DEBUG:  257+  >>>> reg unload HKLM\zSCHEMA
ERROR: The parameter is incorrect.

The image was Win11_23H2_English_x64.iso, Context:6

@DRCRecoveryData
Copy link

I've noticed a few errors during image cleanup:

Disabling Teams:
DEBUG:  168+  >>>> & 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications' '/v' 'ConfigureChatAutoInstall' '/t' 'REG_DWORD' '/d' '0'
'/f'
ERROR: Access is denied.
DEBUG:  196+  >>>> & 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps' '/f'
ERROR: The system was unable to find the specified registry key or value.
DEBUG:  210+  >>>> reg unload HKLM\zDRIVERS
ERROR: The parameter is incorrect.
DEBUG:  257+  >>>> reg unload HKLM\zSCHEMA
ERROR: The parameter is incorrect.

The image was Win11_23H2_English_x64.iso, Context:6

Try this:

# Disable Teams
try {
    & 'reg' 'add' 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications' '/v' 'ConfigureChatAutoInstall' '/t' 'REG_DWORD' '/d' '0' '/f' | Out-Null
} catch {
    Write-Host "Error disabling Teams: $_"
}

# Delete registry key if it exists
if (Test-Path "HKLM:\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps") {
    try {
        & 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps' '/f' | Out-Null
    } catch {
        Write-Host "Error deleting registry key: $_"
    }
}

# Unload registry hives
$registryHives = @('HKLM\zCOMPONENTS', 'HKLM\zDRIVERS', 'HKLM\zDEFAULT', 'HKLM\zNTUSER', 'HKLM\zSCHEMA', 'HKLM\zSOFTWARE', 'HKLM\zSYSTEM')

foreach ($hive in $registryHives) {
    try {
        & 'reg' 'unload' $hive | Out-Null
    } catch {
        Write-Host "Error unloading registry hive $hive: $_"
    }
}

# Remaining code for image cleanup...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@eugenesan @DRCRecoveryData and others