question

CodyRiggs-9596 avatar image
1 Vote"
CodyRiggs-9596 asked rvtdadmin-9567 commented

USMT LoadState failing to create User profiles

2020-07-02 10:26:51, Error [0x080000] There was an error while calling CreateProfile. Error: 0x80070005
2020-07-02 10:26:51, Error [0x000000] Error 2147942405 creating profile: Win32Exception: There was an error while calling CreateProfile.: Access is denied. [0x80070005] class UnBCL::String __cdecl Mig::COnlineWinNTPlatform::CreateProfileForUserPrivate(class UnBCL::String ,class UnBCL::String ,class UnBCL::String ,class UnBCL::String ,int,class UnBCL::String ,class UnBCL::String )
2020-07-02 10:26:51, Error [0x000000] Error creating profile for user Domain\User (source user Domain\User)
2020-07-02 10:26:51, Info [0x000000] Failed.[gle=0x00000091]
2020-07-02 10:26:51, Info [0x000000] A Windows Win32 API error occurred
Windows error 2147942405 description: Access is denied.[gle=0x00000091]
2020-07-02 10:26:51, Error [0x0802f5] CMediaManager::Close: m_pSelectedTransport->Close(1) failed with Exception Win32Exception: Device was open with readonly access.: Access is denied. [0x00000005] void __cdecl Mig::CMediaManager::CloseTransport(int)
void __cdecl Mig::CUNCTransport::Close(int).[gle=0x00000091]
2020-07-02 10:26:51, Error [0x000000] MigCloseCurrentStore caught exception: Win32Exception: Device was open with readonly access.: Access is denied. [0x00000005] void __cdecl Mig::CMediaManager::CloseTransport(int)
void __cdecl Mig::CUNCTransport::Close(int)[gle=0x00000091]
2020-07-02 10:26:51, Info [0x000000] USMT Completed at 2020/07/02:10:26:51.224[gle=0x00000091]
2020-07-02 10:26:51, Info [0x000000] ----------------------------------- USMT ERROR SUMMARY -----------------------------------
2020-07-02 10:26:51, Info [0x000000]
USMT error code 71:
2020-07-02 10:26:51, Info [0x000000] +-----------------------------------------------------------------------------------------
2020-07-02 10:26:51, Info [0x000000] | A Windows Win32 API error occurred
2020-07-02 10:26:51, Info [0x000000] | Windows error 2147942405 description: Access is denied.


this seems to be only occurring on devices that are 1803, have 0 issues restoring client data using the below script on 1909 devices

Here's the Restore Script we are using

Start function Restore

function Restore{

$OldPCName = $BackupPCDropDownBox.Text
$BackupPath = LocationSelection

$USMTPath = USMT64Path -BackupPath $BackupPath
$loadstateFile = $USMTPath + '\loadstate.exe'

$BackupPath = "$BackupPath\USMT_Store"
$PCRestorePath = $BackupPath + '\' + $OldPCName
$InstalledPrinterFile = $PCRestorePath + '\InstalledPrinters.csv'

if((Test-path $PCRestorePath) -eq $false)
{
$outputBox.AppendText("No folder associated with $OldPCName found in $BackupPath" + "`r`n")
Return
}

Set-Location $BackupPath
Set-Location $USMTPath

$USMTarglist = @(
"$PCRestorePath"
"/l:$PCRestorePath\load.log"
'/i:MST-MigUser.xml'
'/i:MST-MigApp.xml'
'/uel:180'
'/v:13'
'/nocompress'
)
#run loadstate to restore user data

 $outputBox.AppendText("Restoring data from PC $OldPCName to PC $LocalPCName ..." + "`r`n")
 $outputBox.AppendText("Restoring user data, please wait..." + "`r`n")
 $Process = Start-Process $loadstateFile -ArgumentList $USMTarglist -Verb runas
    
 #Restore Printers
 RestorePrinters

 #Running SCCM client action cycles
 Invoke-CMClient

 #check loadstate process, once it's complete, output a message
 Start-Sleep 1
 Do
 {
     $loadstateProcess = Get-Process loadstate -ErrorAction SilentlyContinue
     if($loadstateProcess -eq $null)
     {
         $outputBox.AppendText("User data have been restored." + "`r`n")
     }
 }While($loadstateProcess)


 #Move files from C:\Cardio to C:\ProgramData\Cardio
 RestoreCardio

 #Update SPOK database
 #updateSPOK -OldPCName $OldPCName

 $outputBox.AppendText("********Restore Complete********" + "`r`n")

}

end function Restore





not-supported
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@CodyRiggs-9596
It looks like your issue pertains more to PowerShell, which is currently not supported in the Q&A forums. You can find the list of supported products here.


For assistance with PowerShell issues, please refer to our PowerShell Community.


Thank you for your time!


0 Votes 0 ·

@JamesTran-MSFT
I think the problem is NOT related to PowerShell, because we are experiencing exactly the same problem without using PowerShell.
We call Loadstate manually and logged in as domain administrator. Opening cmd with "open as administrator" still results in the errors mentioned above.


Everything worked great until about half a year ago - I suspect a connection with the switch to Office 365, but not sure about that.


Our current workaround is that the user to be migrated logs on to the computer once before calling Loadstate - then the restore also works.


Any new ideas about this would make me very happy.


0 Votes 0 ·
JordanCalo-7541 avatar image JordanCalo-7541 OliverBleckmannlokalerAdmin-4298 ·

Did you ever find a solution for this issue? We are seeing the same problem with USMT and Windows 10 1909. Devices running 1809 do not have any issues. We are not using any PowerShell with our migration.

0 Votes 0 ·
Show more comments

So I had this same issue. What I've been able to determine is that the LoadState creates the profile and then fails out with a 71 error. Check your logs and the username it fails on may change every time you try to run it. I also noticed that after every attempt I had a new user folder under C:\users.

I had a scan that contained 17 profiles and my 18th time trying the LoadState it worked. No idea on a fix yet but it may work if you keep trying it over and over and over and over.

0 Votes 0 ·

1 Answer

JordanCalo-7541 avatar image
1 Vote"
JordanCalo-7541 answered rvtdadmin-9567 commented

I wanted to follow up on this issue because I finally figured it out for my environment.

The problem was occurring because OneDrive was being included in the build and capture for my reference image. That process is controlled by SCCM.

USMT works great once I pulled the OneDrive install step from the build process. Hopefully Microsoft can provide a bug fix. Until then, I will include OneDrive as a post deployment application install.

72550-2021-02-26-17-34-40-eis93pc-remote-desktop-connect.png

72580-2021-02-26-17-35-41-eis93pc-remote-desktop-connect.png





· 9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I tracked this down a little further, and what is happening is that the OneDrive per-machine installation is creating the Classes registry for the Default user account and setting some default registry permissions. If you look on a computer with OneDrive per-machine vs without, you'll see that the with has several files named UsrClass.dat* under C:\Users\Default\AppData\Local\Microsoft\Windows. If you delete those, then the USMT error goes away, but the newly created/migrated profile also would be missing the new OneDrive settings in the registry. I would also agree this is a bug on Microsoft's part, but I think the way I'm going to fix it is to mount the UsrClass.dat registry hive and fix the permission on what's stored under the default user profile folder.181586-access-denied.png


181602-default-classes.png


3 Votes 3 ·
access-denied.png (51.4 KiB)
default-classes.png (31.1 KiB)

I have not seen the OneDrive login issue recently on the later versions of Windows 10/later versions of OneDrive?

0 Votes 0 ·
63084460 avatar image 63084460 ThomasEhlerAU-4063 ·

Using the latest version of OneDrive is the first thing I tried. Windows 10 21H2 + OneDrive 22.033.0213.0002 definitely still has the issue.

0 Votes 0 ·
Show more comments

I have been struggling with this for a bit. Tried to do the same thing as you with process monitor to find the access issue but missed that, so nice one :)

This started happening to me since switching from MDT to Autopilot for deployments which may be unrelated. I definitely don't have the issue on the MDT imaged computers and do on all the Autopilot.

I am using Windows 10 21H2 + OneDrive 22.033.0213.0002 in both scenarios.

The computers that don't have this issue do not have the C:\Users\Default\AppData\Local\Microsoft\Windows\UsrClass.dat files at all.

On the computers that experience this issue and do have the Default user UsrClass.dat files present, I can't get the file to load in Regedit. "An error is preventing this key from being opened. Details: Access is Denied" I've taken copies, can edit in notepad, load other UsrClass.dat files, etc., but can't get that one to load so can't change key permissions.

At this point, I just deleted the UsrClass.dat files out of the Default user folder. USMT seems to work fine and I'm not sure what I'm not getting migrated by just deleting the file. Onedrive gets configured by GPO for each profile and I actually exclude all Onedrive files in the migration and just let Onedrive handle it.

Thanks for posting your findings!



0 Votes 0 ·
63084460 avatar image 63084460 rvtdadmin-9567 ·

Well with Autopilot and OneDrive, we don't need USMT anymore, all self service right ;)

I didn't have any problems mounting the registry hive, obliviously you have to be running Regedit.exe with full administrator rights. And Administrators would need the TakeOwnership privilege, so not sure if you're messing with your user rights assignments in GPO at all or not.

We have a front end UI that we wrote for the techs to run Scanstate and Loadstate, because lets be honest, the command line switches are a pain. I just got done updating that UI yesterday to fix the permissions issues on the UsrClass.dat hive if the file exists. I had to TakeOwnership of the tree first, and then I could update the permissions, because the bad permissions in there don't allow Administrators write rights.

I think you'll be Ok just deleting the file, I have OCD on trying to do things perfect and needed the challenge.

1 Vote 1 ·
Show more comments

Great find! And thank you for returning with feedback on this issue!

With kind regards
Thomas Ehler - EhlerTech
Home of the USMTGUI migration managers

0 Votes 0 ·

Strange though

Just had one doing the same. However we do not install Onedrive but we do install Office 365.

Also just had one PC where the user cannot login to Offce 365 after restore.
I tested this in a variety of scenarios but cannot recreate the error.

0 Votes 0 ·