Fixing a Disk or partition Cloned to new SSD not booting

posted Jan 23, 2016, 6:53 PM by Chris Franklin

Boot into into a Win7 recovery setup (win7 repair option on a system restore disk will work just find).

  1. Make sure the New drive & partition are marked active
    1. simplest way to do this is just run a a startup repair from the recovery options (this will work even if NO windows installation was found during the recovery environment loading)
    2. The second way is to use diskpart from the command line. This is more involved and you'll need to know the layout of your drives & partitions but an example of a making the 1st partition on the 1st drive active would be as fallows (from the cli).
      1. diskpart      
      2. select disk 0
      3. select partition 1
      4. active
      5. exit 
  2. open a command prompt
  3. run the fallowing 1 after another
    1. Bootrec.exe /FixMbr
    2. Bootrec.exe /FixBoot
    3. Bootrec.exe /RebuildBcd
  4. If you still can't boot no worries, just rebuilt the windows boot files (this example assumes windows is installed to your C drive.
    1. bcdboot.exe C:\Windows /s C:
  5. reboot
If your get a boot menu listing more then 1 listing of "Windows 7". Just edit the boot menu and remove one of the copies OR simpler yet just hide the menu.

  1. Right click on "computer"

  2. Select Properties

  3. Click on advanced system settings

  4. Select Advanced tab

  5. Under startup and recovery, click on settings

  6. Under operating system select the one you want to boot i.e. the operating system which works fine

  7. UnCheck the option “Time to display list of operating systems” 

  8. Click on OK

  9. Restart the computer.




Compressing a Profile

posted Oct 15, 2015, 6:00 AM by Chris Franklin   [ updated Oct 16, 2015, 4:40 AM ]

Tools you'll need:

Tools

imagex

Can be found here.

Whats does this script do ?
  • Compresses and verifies a complete profile into a single wim file

How to Run this Script
  • example to backup the user profile franklinc
    • Profile-Backup.bat franklinc
  • example to backup the user profile aspire
    • Profile-Backup.bat franklinc


My Working script

Script

@echo off

:::: Test for cli ARG
IF [%1] == [] echo No Profile/Username set, Example: Profile_Backup_.bat franklinc & GOTO :EOF

:::: SET USERN to cli ARG
SET USERN=%1

:::: Check if profile exists
IF NOT EXIST "c:\Users\%USERN%" echo "No Profile found @ C:\users\%USERN%" & GOTO :EOF

set PATHTOTOOLS=\\files\scripts\wpm\Tools\Waik_3\amd64

:::: Run Backup
%PATHTOTOOLS%\imagex.exe /capture "c:\Users\%USERN%"  /verify /check /compress maximum "C:\Profile_%COMPUTERNAME%_%USERN%.wim" "Profile:%COMPUTERNAME%:%USERN%" "Profile:%COMPUTERNAME%:%USERN%"
IF %ERRORLEVEL% NEQ 0 echo Error Backing up Profile & GOTO :EOF


Extra step!!
  • Backup / Export the Reg profile for the account from ***UNDER
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

Example Reg exported

Profile-Aspier.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-1407137883-3464530159-1217028313-11339]
"ProfileImagePath"=hex(2):43,00,3a,00,5c,00,55,00,73,00,65,00,72,00,73,00,5c,\
  00,61,00,73,00,70,00,69,00,72,00,65,00,00,00
"Flags"=dword:00000000
"State"=dword:00000204
"CentralProfile"="\\\\files\\aspire\\profile.V2"
"Sid"=hex:01,05,00,00,00,00,00,05,15,00,00,00,5b,38,df,53,ef,88,80,ce,d9,60,8a,\
  48,4b,2c,00,00
"ProfileLoadTimeLow"=dword:00000000
"ProfileLoadTimeHigh"=dword:00000000
"RefCount"=dword:00000000
"RunLogonScriptSync"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-1407137883-3464530159-1217028313-11339\Preference]








Expanding a Pre-made Profiles to a Desktop(s)

posted Oct 15, 2015, 5:46 AM by Chris Franklin   [ updated Oct 16, 2015, 4:39 AM ]

You'll need the fallowing tools:

Tools

fciv
imagex

Both can be found here.


Whats does this script do ?
  1. tests weather or not the user for which we want to create the profile is logged in and if so exit
  2. Only run if it has run and completed all tasks successfully
  3. Only run / repeat only the tasks that appear to not be completed right
  4. HASH check everything !!
  5. Copy "larger" files to the local computer, But NEVER the hash files !!


My Working Script

Profile-Aspire.bat

@echo off

:::: Test if profile is active / logged in
quser | find "aspire"
IF %ERRORLEVEL% == 0 GOTO :EOF

SET SERVERPATH=\\files\scripts\wpm
SET LOCALPATH=C:\windows\scripts

IF EXIST %SERVERPATH%\CreateLocalStorageBase.bat call %SERVERPATH%\CreateLocalStorageBase.bat

SET SCRIPTNAME=create_aspire_profile.v2
SET HASHTOOL=C:\windows\scripts\admins\fciv.exe
SET EXPANDIMAGE=0

IF NOT EXIST %LOCALPATH%\admins mkdir %LOCALPATH%\admins
IF NOT EXIST %LOCALPATH%\logs mkdir %LOCALPATH%\logs

IF EXIST %LOCALPATH%\logs\.%SCRIPTNAME% GOTO :EOF

echo Creating Aspire Testing Profile

echo ^ =^> Hash Tool Check
IF NOT EXIST %HASHTOOL% GOTO :CPHASHTOOL
IF EXIST %HASHTOOL% %SERVERPATH%\Tools\fciv.exe -v -XML %SERVERPATH%\Tools\fciv.exe.hash >NUL
IF %ERRORLEVEL% EQU 0 GOTO :HASHTOOL
:CPHASHTOOL
echo ^ =^> Hash Tool Loading
xcopy /Y /V /Z %SERVERPATH%\Tools\fciv.exe %LOCALPATH%\admins
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
echo ^ =^> Hash Tool Loaded
:HASHTOOL

::: Check if profile exists and the hashs check out, if not recopy it
SET FILES=%SERVERPATH%\Profiles\Profile-aspire.wim
SET FILEL=%LOCALPATH%\admins\Profile-aspire.wim
IF NOT EXIST "%FILEL%" GOTO :YESCPProfile
IF EXIST "%FILEL%" %HASHTOOL% -v -XML "%FILES%.hash" >NUL
IF %ERRORLEVEL% EQU 0 GOTO :NOCPProfile
:YESCPProfile
echo ^ =^> Copying Profile image to local machine
xcopy /Y /V /Z "%FILES%" %LOCALPATH%\admins
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
:NOCPProfile

SET FILES=%SERVERPATH%\Tools\Waik_3\amd64\imagex.exe
SET FILEL=%LOCALPATH%\admins\imagex.exe
IF NOT EXIST "%FILEL%" GOTO :YESCPimagex
IF EXIST "%FILEL%" %HASHTOOL% -v -XML "%FILES%.hash" >NUL
IF %ERRORLEVEL% EQU 0 GOTO :NOCPimagex
:YESCPimagex
echo ^ =^> Copying Profile image tool to local machine
xcopy /Y /V /Z "%FILES%" C:\windows\scripts\admins
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
:NOCPimagex


echo ^ =^> Checking for existing profile
IF NOT EXIST c:\Users\aspire GOTO :NOLPROFILE
echo ^ =^> Hash Check Existing Profile
%HASHTOOL% -v -XML %SERVERPATH%\Profiles\Profile-aspire.hash >NULL
IF %ERRORLEVEL% EQU 0 GOTO :YESLPROFILE

echo ^ =^> Deleting Old Profile
IF EXIST c:\Users\aspire RD /S /Q c:\Users\aspire
IF EXIST c:\Users\aspire RD /S /Q c:\Users\aspire
:NOLPROFILE

echo ^ =^> Creating local DIR if needed
IF NOT EXIST c:\Users\aspire mkdir c:\Users\aspire
IF NOT EXIST c:\Users\aspire mkdir GOTO :EOF

echo ^ =^> Uncompressing image
SET EXPANDIMAGE=1
%LOCALPATH%\admins\imagex.exe /APPLY %LOCALPATH%\admins\Profile-aspire.wim 1 c:\Users\aspire
IF %ERRORLEVEL% NEQ 0 GOTO :EOF

:YESLPROFILE

echo ^ =^> Settings up REG Profilelist keys
regedit /S %SERVERPATH%\Profiles\Profile-aspire.reg
IF %ERRORLEVEL% NEQ 0 GOTO :EOF

IF %EXPANDIMAGE% EQU 0 GOTO :NOREHASH
echo ^ =^> Hash Check Expanded Profile
%HASHTOOL% -v -XML %SERVERPATH%\Profiles\Profile-aspire.hash >NULL
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
:NOREHASH

echo ^ =^> Done
date /T > %LOCALPATH%\logs\.%SCRIPTNAME%
date /T > \\files\techinfo\wpm\%COMPUTERNAME%.%SCRIPTNAME%
:EOF



Things you'll need to change
  • My UNC paths to where I store my tools,reg files and profile
    • \\files\scripts\wpm\
  • The account in question in this scripts case
    • aspire  
Things you'll need to do
  • Create your own Profile (See my how to here)
  • Create hashes of all the needed files,dir and tools
    • Examples
      • Hash file for imagex.exe (You don't have to store the whole path in the XML file nor do you have to store BOTH hash types. But I do.)
        • fciv.exe -add C:\windows\scripts\admins\imagex.exe -both -xml \\files\scripts\wpm\Tools\Waik_3\amd64\imagex.exe.hash
      • Hash for the WHOLE profile aspire
        • fciv.exe -add C:\users\aspire -r -both -xml \\files\scripts\wpm\Profiles\Profile-aspire.hash



1-3 of 3