Hi :)

I've run into a problem that I've been spending far to much time on already :P

I'm trying to use USMT hardlink functionallity for future re-installations, but it will not work unless I do a manual reboot during.

It looks like this:
Task 1, copy files:
-----
    rem copying files...
    xcopy *.* /e /v /y C:\Windows\USMT\
------

Task 2, run the scanstate:
------
  @ECHO On

  echo Removing old USMT store if it exist...
  rem Usmtutils.exe /rd c:\USMTstore /Y
  if exist c:\USMTstore rd c:\USMTstore /S /Q

  c:
  cd Windows\USMT

  echo Setting USMT_WORKING_DIR
  set USMT_WORKING_DIR=C:\Windows\USMT
  echo USMT_WORKING_DIR was set to: %USMT_WORKING_DIR%

  echo Running ScanState...
  C:\Windows\USMT\scanstate.exe c:\USMTstore /v:13 /o /c /offlineWindir:C:\Windows /hardlink /nocompress /efs:hardlink /i:C:\Windows\USMT\MigApp.xml /i:C:\Windows\USMT\MigDocs.xml

  Y:
-----------
If I run this I will end up with an error when Windows 7 comes to Expanding files
Error: "Windows cannot install required files. Make sure all files required for installation are available, and restart the installation"

If I then reboot, and run the installation without the Scanstate hardlink component in it, then it works like a charm and all the files are still there and I can do a loadstate.
But I'm forced to do a reboot after, it seems like the hardlink process locks the disk or something.


Anyone have any good ideas?

This would save a lot of time during re-installs if we can avoid copying all the user data before and after a rebuild, we are currently running split drives one for windows/programs and one for user files, but every now and then Windows and Programs size keep increesing so we have to resize disks, and that is what I'm trying to avoid.


I tried to do a diskpart to do a "remove" to unload the C drive and map it again, but I cannot "remove" it :/


Edit: added full error msg