How to recover a ‘disassociated’ Windows NT user account’s files and settings into a new profile when the SAM ID is no longer valid on the machine or domain

System Requirements:

  • Windows Vista
  • Windows Server 2008, R2
  • Windows 7

The Problem:

Take the hypothetical situation: Windows 7 fails to boot, you don’t want to lose your user data so you install 7 onto a clean partition. However your old user profile is associated with the random SAM ID from the old installation and the new Windows installation cannot mount the profile. You can copy your data files back over, but you really don’t want to configure the start menu settings for the 1,000,000th time.

Or how about: Your only domain controller failed leaving disassociated roaming profiles on a roaming profile share and you want to recover as much of the user settings and data as possible for use on the newly build AD forest. <– That actually happened to Matt, hence I day dreamed this up.

More Information:

NT user accounts are associated to a Security Account Manager (SAM) ID. The SAM ID is Windows’s SAM or the Active Directory domain user services way of identifying a user, in effect the SAM ID is a super key that identifies a user account on a windows system, acting as a GUID for that profile.

The user name itself is irrelevant and plays no part in identifying the user account apart from being used to performing a reverse lookup to get to the SAM ID, on which Windows bases its logon activities and security token generation in AD.

When you reinstall Windows, the new installation has no awareness of any of the accounts, so if you copy the profiles back into the Windows users directory you will be unable to re-associate that profile with the local SAM database.

The Fix

The simplest way of restoring user data and crucially environment settings (such as desktop wallpaper, window settings and the like) is to follow this process:

  1. Create a new user account for the user you want to migrate onto the new domain/installation
  2. Set the accounts roaming profile settings (if dealing with a roaming profile)
  3. Logon to the machine with Administrator rights
  4. Load Regedit
  5. Click on HKEY_USERS
  6. From the File menu, select Load Hive…
  7. Browse to the NTUser.dat from the previous install/roaming profile for the profile that you are trying to recover and click OK e.g.
    d:\rescued_users\Matt\NTUser.dat
  8. When prompted for a name just enter temp and click OK
  9. Expand and click on:
    HKEY_USERS\temp
  10. From File select export and save the export file as:
    c:\temp.reg
  11. From File, select Unload Hive…
  12. Exit Regedit
  13. Open c:\temp.reg
  14. From the Edit menu select Replace…
  15. In Find What: enter:
    HKEY_USERS\temp
    In Replace With: enter:
    HKEY_CURRENT_USER
    Press Replace All
  16. Save the reg file and exit notepad
  17. Log off of Administrator
  18. Log on as the new user
  19. Double click on c:\temp.reg and import the reg file into the new (completely default) user account. If you are using a system with UAC you will need to import the reg file using an administrators account.
  20. Immediately log off
  21. Log back in as Administrator
  22. Go to the recovered profile folder e.g.
    d:\rescued_users\matt\
  23. Select all files in the folder apart from NTUser.dat, NTUser.ini and NTUser.dat.log and copy them
  24. Paste the data into the new user profile e.g.
    c:\users\matt
  25. The data and the profile settings have now been recovered. Logging back in as the recovered user will restore much of the user profile and all of their data.

Note: It may be necessary to reset folder permissions and ownership on all of the files pasted into the folder to match that of the new user account.

Thanks to Matt Gillard of MGComputing for some testing of my theory.

Microsoft JET Database Engine error ‘80040e21’ – Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

System Requirements:

  • Windows NT 4.0
  • Windows 2000
  • Windows XP
  • Windows Server 2003
  • Windows Vista
  • Windows Server 2008
  • Windows 7

The Problem:

When you attempt to connect to a Microsoft Access database using the ODBC provider Microsoft.Jet.OLEDB.4.0 you receive the error message:

Microsoft JET Database Engine error ‘80040e21’
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done./path/file.asp, line ##

 

More Information:

There are a number of issues that can cause this error, they are poorly documented elsewhere online but the information is there; connection string, registry values slightly offset and so fourth. This document deals with one specific issue which is related to the idea of this being caused by an incompatible type value.

The chances of you running into this are quite extreme, however it is an issue in JET (Microsoft Access) that doesn’t exist in Microsoft SQL Server and thus if you are dealing with code transitioning you may want to know about the problem in this very extreme and unlikely situation.

You shouldn’t need to reboot to solve the problem, it didn’t in my case. However, if nothing happens do restart before progressing to the next step.

SQL Example

The following SQL Statement will execute on Microsoft SQL Server and return a RecordSet however the same SQL on JET 4.0 will result in the error message outlined above.

SELECT
Student.StudentID,
Student.FirstName,
Student.LastName,
Student.EMail,
null AS studentPhotoBLOB,
Left(StudentID,1) AS YearPrefix
FROM Student;

No, it isn’t the T-SQL LEFT() statement that is the problem. The issue lies in the “null AS studentPhotoBLOB”.

The idea behind this is that space has been reserved in the record set. Why would you want to do this? If you want to drop the record set directly into an array, then ADO can do this for you using the GetRecords method. However if you want to change the structure you have to re-parse the array and relocate the data into a new structure. You can inset a null named record and use the space in the GetRecords array later for other purposes.

The problem here is that null is not a data type that is supported by JET; it is supported by Microsoft SQL Server however.

The simplest way to remedy the situation is to either change the SQL or dynamically detect JET to change the variable type to a commonly supported data type, for example a String.

SELECT
Student.StudentID,
Student.FirstName,
Student.LastName,
Student.EMail,
” AS studentPhotoBLOB,
Left(StudentID,1) AS YearPrefix
FROM Student;

This is naughty, however in a weak typed language such as ASP it isn’t a real problem given the situation outlined above. The use of ” instead of null forces the data type of the column into a string and thus it can be parsed by JET.

Cannot install the integrated audio AC97′ hardware from a Asus P4S333 or P4S533 under Windows Vista

System Requirements:

  • Windows Vista SP1
  • Windows Server 2008

The Problem:

So, you get fed-up of trying to get PCI sound cards working under Vista and opted for the integrated sound CPU clogging solution?! I don’t blame you.

The P4S333 may be old kit, but it’s a solid motherboard, very much Vista capable with the right upper end P4 and enough RAM, particularly if you flashed the P4S333 with the P4S533’s BIOS to make use of the 533 MHz FSB. The difficulty we have is however in that the C-Media CMI8738 AC97′ chip that the board uses cannot be matched to any of Windows Updates hardware ID’s and Asus, naturally, do not offer a Vista driver.

More Information:

Thankfully, C-Media do provide generic drivers, and there is a January 2009 driver release for the CMI8738 as of writing. The driver does work once you get it out of the RAR file, however:

  1. The driver does not have the necessary hardware ID to install automatically against the customised chip on the P4S333 / P4S533
  2. The driver is not digitally signed

Despite that, I’ve not seen any problems with it, and despite the CPU connotations, it got rid of irritating buzzing that the Creative Labs Sound Blaster Live! 5.1 was causing with the useless Vista driver set.

The Fix

Very simply, you need to manually install the driver.

  1. Download the latest CMI8738 driver from C-Media (http://www.cmedia.com.tw/). As of writing the driver version was 8.17.33 and it worked a treat
  2. Deflate the RAR into the file system
  3. Open the Control Panel
  4. Open the Device Manager
  5. Find the uninstalled multimedia device in the Other Devices section, right click, Update Driver Software
  6. Click Browse my computer for driver software
  7. Click let me pick from a list of device drivers on my computer
  8. Hit the have disk button
  9. Browse to the path that you inflated the RAR file to, for example if you inflated the RAR file to c:\temp\ you want to browse to the following location:
    c:\temp\PCI-8738-090109-8.17.33(Vista3264-RC-01)\SoftwareDriver\driverNote that if the driver version you are using is newer, then the version in the file name will clearly be different. Ultimately however you are looking to point to the SoftwareDriver\driver folder (there are several INF’s and some CAT files in here)
  10. In the manufacturer list from the available select:
    C-Media
  11. From the Model list select:
    C-Media PCI Audio Device
  12. Click Next
  13. Windows will notify you that the driver has not been digitally signed. You’re going to have to tough this one out I’m afraid and install it.
  14. At that point the audio should just start working.

When you attempt to use the Magnifier button on a Microsoft Comfort 3000 optical mouse, the screen flashes when the magnifier loads

System Requirements:

  • Windows Vista SP1
  • Windows Server 2008

The Problem:

Yet another Vista problem, and it’s not a Driver one.

If you own a Microsoft Mouse, and have the latest version of IntelliPoint installed, chances are that you are aware that the function for the red button on the side is to enable the screen magnifier by default.

This feature is particularly useful if you are visually impaired, however upon moving from Windows XP to Windows Vista you will note that when attempting to load the magnifier, the screen will flash to black, slowly re-draw and once the magnifier window finally loads there will be nothing in it for around a second before the graphics subsystem catches up. To make matters worse, the entire processing of the magnified image becomes very CPU intensive, which interferes with other processes such as text to speech.

More Information:

This is a feature. Joy.

The new Vista Windows Display Manager uses off-screen rendering buffers to supply the GUI with all the nice visual effects that you have become used to in the Vista world. The problem is that when you click the magnification button, the system has to recycle the entire screens worth of data before it can redraw the image. This is compared to the old Windows XP and lower system where each window on the screen was responsible for drawing itself.

The Fix

The following steps will outline how to prevent Vista from completely redrawing the screen when you hit the magnifier. Please note that by doing this you will lose GUI features and fancy effects.

  1. Ensure that you have installed the latest version of Microsoft IntelliPoint (Version 6.3 at the time of writing).
    IntelliPoint is available to download for free from: http://www.microsoft.com/hardware/
  2. Open the Control Panel
  3. Open the System Applet
  4. In the left hand navigation pane select the Advanced System Settings option
  5. Click the Settings button in the performance section of the Advanced tab
  6. Remove the tick box next to Enable Desktop Composition
  7. Click OK twice to return to the control panel. Note that the screen will flash and that Aero effects will be disabled