PowerShell USMT Error 26 не может получить доступ к файлу Windows даже под учетной записью администратора - PullRequest
0 голосов
/ 26 мая 2019

Я пытаюсь сделать резервную копию, используя usmt, и создаю простой сценарий для его обработки, проблема в том, что когда я работал с внешнего доменного устройства, оно работало просто отлично, теперь при использовании активного каталога он не может получить доступФайлы Windows, даже с учетной записью администратора.

первая строка для запуска его от имени администратора, и я использую пользователя с правами администратора на этом компьютере, поэтому я не могу понять, в чем проблема

    if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
Set-ExecutionPolicy Bypass
Do {

    $whichState = Read-Host -Prompt 'Do you want to Backup Or Restore for Backup Enter "B" and for Restore Enter "R"'

    if ($whichState -eq "b" ) {
        # $preUsbLetter = Read-Host -Prompt 'Enter Usb Letter'
        $preUsbLetter = 'a'
        if ($preUsbLetter.length -eq 1 ) {
            $testBackup = '\\12.34.56.789\softwares\TestBackup'
            # $usbLetter = $preusbLetter + ":\usmt"
            $usbLetter = $testBackup + "\usmt"
            $employeeNumber = Read-Host -Prompt 'Enter your employee Number'
            $backupFolder = "\USER#" + $employeeNumber
            # $backupPath = $usbLetter + '\backup' + $backupFolder
            $backupPath = $testBackup + $backupFolder
            Write-Host "usb path is $usbLetter and user number is $employeeNumber and backup bath is $backupPath "

            $Activ = 'Backup'
            $stat = 'userData Backing up'
            Write-Progress -Activity $Activ -Status $stat -PercentComplete 25

            Set-Location $usbLetter
            SkipUserData=No

            .\scanstate $backupPath /o /c /i:MigUser.xml /i:MigDocs.xml /i:MigApp.xml /localonly


            Read-Host -Prompt "DONE press Enter To exit"
            break

        }
        else {
            write-host "-------------------------------"
            write-host "Wrong Input"
            write-host "-------------------------------"
        }
    }
    elseif ($whichState -eq "r") {

        $preUsbLetter = Read-Host -Prompt 'Enter Usb Letter'

        if ($preUsbLetter.length -eq 1 ) {
            # $usbLetter = $preusbLetter + ":\usmt"
            $usbLetter = $testBackup + "\usmt"
            $testBackup = '\\12.34.56.789\softwares\TestBackup'
            $employeeNumber = Read-Host -Prompt 'Enter your employee Number'
            $backupFolder = "\USER#" + $employeeNumber
            # $backupPath = $usbLetter + '\backup\' + $backupFolder
            $backupPath = $testBackup + $backupFolder
            Write-Host "usb path is $usbLetter and user number is $employeeNumber and backup bath is $backupPath "

            $Activ = 'Restore'
            $stat = 'Restoring UserData'
            Write-Progress -Activity $Activ -Status $stat -PercentComplete 25

            Set-Location $usbLetter

            .\loadstate /i:MigApp.xml /i:MigUser.xml /i:MigDocs.xml $backupPath /all /lac: P@ssw0rd /lae /c


            Read-Host -Prompt "DONE press Enter To exit"
            break

        }
        else {
            write-host "-------------------------------"
            write-host "Wrong Input"
            write-host "-------------------------------"
        }
    }
    else {
        write-host "-------------------------------"
        write-host "Wrong Input"
        write-host "-------------------------------"
    }

}while ($true)

файл журнала

2019-05-26 10:28:07, Info                  [0x000000] SCANSTATE.EXE[gle=0x000000b7]
2019-05-26 10:28:07, Info                  [0x000000] USMT Started at 2019/05/26:10:28:07.821
2019-05-26 10:28:07, Info                  [0x000000] Command line: \\12.34.56.789\softwares\TestBackup\USMT\scanstate.exe \\12.34.56.789\softwares\TestBackup\USER#111 /o /c /i:MigUser.xml /i:MigDocs.xml /i:MigApp.xml /localonly
2019-05-26 10:28:07, Info                  [0x000000] Starting the migration process
2019-05-26 10:28:07, Warning               [0x080405] AdjustPrivilege: AdjustTokenPrivileges failed (Error:0x514)
2019-05-26 10:28:07, Warning               [0x080405] AdjustPrivilege: AdjustTokenPrivileges failed (Error:0x514)
2019-05-26 10:28:07, Warning               [0x080405] AdjustPrivilege: AdjustTokenPrivileges failed (Error:0x514)
2019-05-26 10:28:07, Warning               [0x080405] AdjustPrivilege: AdjustTokenPrivileges failed (Error:0x514)
2019-05-26 10:28:07, Warning               [0x080405] AdjustPrivilege: AdjustTokenPrivileges failed (Error:0x514)
2019-05-26 10:28:07, Error                 [0x018000] 00000001 (F) HRESULT_FROM_WIN32(1300) #1# from LoadStore(target = NULL)
[gle=0x80004005]
2019-05-26 10:28:07, Warning               [0x08040d] SMI engine was unable to load store (hr = 0x80070514)
2019-05-26 10:28:07, Warning               [0x0803d9] IndirectKeyMapper: RegLoadKey(HKEY_LOCAL_MACHINE,$ONLINE_RW$ELAM,C:\windows\system32\config\elam) failed (1314)
2019-05-26 10:28:07, Warning               [0x0803db] IndirectKeyMapper: RegLoadKey(HKEY_LOCAL_MACHINE,$ONLINE_RW$ELAM,C:\windows\system32\config\elam) failed; giving up (1314)
2019-05-26 10:28:07, Error                 [0x080000] Error loading hive C:\windows\system32\config\elam.: Win32Exception: A required privilege is not held by the client. [0x00000522] __cdecl Mig::CIndirectKeyMapper::CIndirectKeyMapper(class UnBCL::String *,struct HKEY__ *,class UnBCL::String *,class UnBCL::String *,int,int,const Mig::HiveLoadRetryOptions *)[gle=0x000000cb]
2019-05-26 10:28:08, Warning               [0x0803d9] IndirectKeyMapper: RegLoadKey(HKEY_USERS,S-1-5-21-1455383882-3198487947-3576469728-1162,C:\Users\backup\NTUSER.DAT) failed (1314)
2019-05-26 10:28:08, Warning               [0x0803db] IndirectKeyMapper: RegLoadKey(HKEY_USERS,S-1-5-21-1455383882-3198487947-3576469728-1162,C:\Users\backup\NTUSER.DAT) failed; giving up (1314)
2019-05-26 10:28:08, Error                 [0x08039d] Cannot add mapping for user profile C:\Users\backup. Error: 1314: Win32Exception: A required privilege is not held by the client. [0x00000522] __cdecl Mig::CIndirectKeyMapper::CIndirectKeyMapper(class UnBCL::String *,struct HKEY__ *,class UnBCL::String *,class UnBCL::String *,int,int,const Mig::HiveLoadRetryOptions *)[gle=0x000000cb]
2019-05-26 10:28:08, Error                 [0x080801] User profile loading error. Aborting due to external request.[gle=0x000000cb]
2019-05-26 10:28:08, Error                 [0x000000] MigPlatformStartupOnline caught exception: Win32Exception: User profile loading error. Aborting due to external request.: The specified user does not have a valid profile. [0x000004E5] void __cdecl Mig::COnlineWinNTPlatform::ProcessUser(class Mig::CRegistryDataStore *,class Mig::CRegistryDataUnit *,class UnBCL::String *,class UnBCL::String *,int,int)
2019-05-26 10:28:08, Error                 [0x000000] Error while trying to start the migration process
2019-05-26 10:28:08, Warning               [0x000000] Internal error 4 was translated to a generic error
2019-05-26 10:28:08, Info                  [0x000000] Failed.
2019-05-26 10:28:08, Info                  [0x000000]   Software malfunction or Unknown exception
2019-05-26 10:28:08, Info                  [0x000000] USMT Completed at 2019/05/26:10:28:08.008
2019-05-26 10:28:08, Info                  [0x000000] ----------------------------------- USMT ERROR SUMMARY -----------------------------------
2019-05-26 10:28:08, Info                  [0x000000] * USMT error code 26: 
2019-05-26 10:28:08, Info                  [0x000000] +-----------------------------------------------------------------------------------------
2019-05-26 10:28:08, Info                  [0x000000] | Software malfunction or Unknown exception, please check the following possible solutions:
2019-05-26 10:28:08, Info                  [0x000000] | - Check log for any errors found in loaded migxml files
2019-05-26 10:28:08, Info                  [0x000000] | - Verify config xml file is not loaded using /i
2019-05-26 10:28:08, Info                  [0x000000] | - If duplicate SID exists from temp profile – use environment variable or delete temp profile
2019-05-26 10:28:08, Info                  [0x000000] +-----------------------------------------------------------------------------------------

1 Ответ

0 голосов
/ 22 июня 2019

Чтобы исправить что-то, у вас должен быть доступ к вещам, которые у вас не так просты, поэтому скажите своему боссу, что он может дать вам то, что вам нужно, или он может сделать это сам.

Выдолжен запускать USMT с использованием учетной записи с полными правами администратора, включая следующие привилегии:

SeBackupPrivilege (резервное копирование файлов и каталогов)

SeDebugPrivilege (отладка программ)

SeRestorePrivilege (Restoreфайлы и каталоги)

SeSecurityPrivilege (Управление журналом аудита и безопасности)

SeTakeOwnership Privilege (Приобретение прав собственности на файлы или другие объекты)

Источник: https://docs.microsoft.com/en-us/windows/deployment/usmt/usmt-requirements

...