Powershell Script to solve 0x80073701 ERROR_SXS_ASSEMBLY_MISSING

AndreasBw123

New member
Joined
Jan 4, 2024
Posts
1
Hello,

i have the following Powershell Script to solve the 0x80073701 ERROR_SXS_ASSEMBLY_MISSING during the Windows Update Process. Because the cbs.log I know it's because the missing (or false installed) Language Pack ~fr-FR~. Reinstall the last cummulative update via dism did not word. And install the Language Pack ~fr-FR~ did not work to.

I can delete In the Windows Registry GUI all the Reg keys manually by taking the ownership of the Key, then full access control, then delete the key and go to next key.
The Powershell Script should do the same, but I have permission falses. Have someone any Idea how I can solve the Powershell Script to do the job?

Thanks


Code:
# Check if start as Admin
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Write-Warning "Dieses Skript muss mit Administratorrechten ausgeführt werden."
    exit
}

$regKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackageDetect"
$regKeysToDelete = Get-ChildItem "Registry::$regKey" | Where-Object {$_.Name -like "*~fr-FR~*"}

# Backup
$backupFilePath = "C:\temp\PackageDetectDeleted.log"
$backupContent = "Windows Registry Editor Version 5.00`r`n`r`n"
foreach ($key in $regKeysToDelete) {
    $keyPath = "$key"
    Write-Host "Keyname: $keyPath"
    $keyValue = Get-ItemProperty -Path "Registry::$keyPath" | Out-String
    $backupContent += "`r`n[$keyPath]`r`n$keyValue"

    # Take Ownership
    $acl = Get-Acl -Path "Registry::$keyPath"
    $acl.SetOwner([System.Security.Principal.NTAccount]"Administrators")
    Set-Acl -Path "Registry::$keyPath" -AclObject $acl

    # Change ACL
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule("Administrators","FullControl","Allow")
    $acl = Get-Acl -Path "Registry::$keyPath"
    $acl.SetAccessRule($rule)
    Set-Acl -Path "Registry::$keyPath" -AclObject $acl

}

Set-Content -Path $backupFilePath -Value $backupContent -Encoding ASCII

# Delelte Registry-Keys
foreach ($key in $regKeysToDelete) {
    $keyPath = "$key"
    Remove-Item -Path "Registry::$keyPath" -Recurse -Force # -ErrorAction SilentlyContinue
    Write-Host "Keyname: $keyPath"
}
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top