Windows 7 Roaming Profile Upload Behavior: Registry Sync vs Full Profile Synchronization During Logoff


2 views

In Windows 7's roaming profile implementation, the background registry upload (enabled via Computer Configuration\Administrative Templates\System\User Profiles\Background upload of roaming user profile's registry file) only handles the NTUSER.DAT file. This partial sync occurs periodically while the user remains logged in.

The complete profile synchronization during logoff includes these critical components:


1. Registry hive (NTUSER.DAT)
2. All files/directories in %USERPROFILE%
3. AppData\Roaming content
4. Desktop items
5. Documents library
6. Favorites
7. Links
8. Saved Games
9. Searches

The Win32_UserProfile class only updates LastUploadTime after full profile sync because:


$profile = Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.LocalPath -eq "C:\Users\username" }
$profile.LastUploadTime # Only reflects logoff sync

When background registry sync is enabled, Windows creates a temporary copy of NTUSER.DAT with this pattern:


\\server\profiles\%username%\NTUSER.DAT.{GUID}.tmp

The sync occurs through the User Profile Service using RPC calls to the domain controller.

For applications storing data in roaming profiles:


// Good practice for roaming-aware apps
string appDataPath = Environment.GetFolderPath(
    Environment.SpecialFolder.ApplicationData);

// Problematic non-roaming locations
string localAppData = Environment.GetFolderPath(
    Environment.SpecialFolder.LocalApplicationData); // Won't roam

The complete sync only occurs during proper logoff sequences. Unexpected shutdowns may cause profile synchronization failures.

Check Event Viewer logs for profile events:


Event ID 1500-1517 in Application logs
Microsoft-Windows-User Profiles Service/Operational log

For programmatic detection of sync completion, watch for these registry changes:


HKCU\Software\Microsoft\Windows NT\CurrentVersion\ProfileNotify
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

In Windows 7's roaming profile implementation, the system handles different components through distinct synchronization mechanisms. The Background upload of roaming user profile's registry file Group Policy setting (located under Computer Configuration\Administrative Templates\System\User Profiles) only handles the registry hive file (NTUSER.DAT) asynchronously.

// Sample WMI query to check LastUploadTime (only updates at logoff)
Get-WmiObject -Class Win32_UserProfile | 
Where-Object { $_.Special -eq $false } | 
Select-Object LocalPath, LastUseTime, LastDownloadTime, LastUploadTime

Despite background registry sync, these components only upload during user logoff:

  • Non-registry profile data: All files/directories in %USERPROFILE% excluding exclusions
  • AppData subfolders: LocalLow and Roaming folders (Local excluded by default)
  • Profile metadata: Directory timestamps and ACL changes
  • Link files: Recent documents, jump lists, etc.

Windows 7 uses a two-phase commit during logoff:

1. Copy changed files to server (\\server\share\%username%) 
2. Update profile version in registry:
   HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%SID%
   - ProfileImagePath
   - State
   - CentralProfile

This PowerShell script demonstrates what actually gets synced:

$profilePath = $env:USERPROFILE
$tempFile = "$profilePath\testfile_$(Get-Date -Format 'yyyyMMddHHmmss').txt"
"Test content" | Out-File -FilePath $tempFile

# Background registry sync occurs within 15 minutes
# File won't sync until logoff

These registry settings control upload behavior:

  • HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SlowLinkTimeOut
  • HKLM\SOFTWARE\Policies\Microsoft\Windows\System\UploadUseThreshold

For optimal performance:

  1. Use folder redirection for Documents/Desktop
  2. Exclude large cache folders via Group Policy
  3. Set appropriate timeout thresholds