.

 

 

FSLogix Profile Container Bloating 2

Introduction

This article is an update to the original FSLogix Profile Bloat article which was targeted at Windows Server 2016 and Windows 10.

The release of Windows 11 and the increased importance of UWP Applications has created additional demands on User Profile personalisation.

FSLogix redirects user profiles to a network location using Profile Container. Profiles are placed in VHD(X) files and mounted at logon. Applications use the profile as if it were on the local drive. Because the FSLogix solutions use a Filter Driver to redirect the profile, applications don't recognize that the profile is located on the network. This generally results in improved logon times. However without careful configuration of your environment, the FSLogix profile containers can grow to multiple gigabytes in size putting a strain and cost on network storage.

The most common offenders for profile bloat include:

  • UWP Applications
  • Microsoft Office
  • Microsoft Teams (New)
  • Microsoft OneDrive
  • Windows Search
  • Google Chrome
  • Microsoft Edge
  • Downloads

User Profiles broadly consist of the following folders.

  • ProfileRoot (C:\Users\<USERNAME>)
  • AppData\Roaming
  • AppData\Local
  • AppData\LocalLow

Any application can add bloat to the user profile. More commonly this occurs when an application writes data to the ProfileRoot or AppData\Local. Therefore this profile strategy will include all files and folders in the Profile Root and AppData\Roaming but exclude all files and folders in AppData\Local and AppData\LocalLow. If a requirement is identified to personalise a subfolder in AppData\Local, an <include> may be added to redirections.xml to capture the data.

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated 2024-10-14 -->
<FrxProfileFolderRedirection ExcludeCommonFolders="128">
<Excludes>
<Exclude Copy="0">AppData\Local</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\OneAuth</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\IdentityCache</Exclude>
</Excludes>
<Includes>
</Includes>
</FrxProfileFolderRedirection>

Microsoft supports this approach.

Device identity and desktop virtualization

Roaming any data under the path %localappdata% is not supported.

Start Menu layout and pinned apps are now stored in AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy

Teams v2 user settings are stored in AppData\Local\Packages\MSTeams_8wekyb3d8bbwe and the Teams Meeting Addin for Outlook settings are stored in AppData\Local\Publishers\8wekyb3d8bbwe\TeamsSharedConfig

The list continues, so inclusions are required for specific subdirectories of AppData\Local. You can of course not exclude AppData\Local however over time you will undoubtedly experience problems such as FSLogix profiles hitting the 30GB size limit and / or frequently having to extend the size of your FSLogix share to accommodate the ever growing profile containers.

You can download scripts to shrink profile containers or enable FSLogix VHD Compaction however these approaches only remove the white space in the profile container which is often re-consumed at the next logon. To truly shrink FSLogix containers, you must remediate the redirections.xml file to exclude profile bloat folders and then use ShrinkVHD or logoff scripts to remove redundant folders from profile containers and then shrink the VHD(X) file.

FSLogix FAQ - FSLogix | Container size

Excluding AppData\Local and including specific subdirectories creates an interoperability issue with FSLogix.

FSLogix FAQ - FSLogix | Include Statement

The solution to this issue is to either pre-create folders in AppData\Local in the Default User profile on your master image

md "C:\Users\Default\AppData\Local\Packages"
md "C:\Users\Default\AppData\Local\Publishers\8wekyb3d8bbwe\TeamsSharedConfig"
md "C:\Users\Default\AppData\Local\Microsoft\OneDrive\Settings"
md "C:\Users\Default\AppData\Local\Google\Chrome\User Data\Default"
md "C:\Users\Default\AppData\Local\Microsoft\Edge\User Data\Default"

or a more dynamic approach is to use a User Environment Manager or Group Policy Folder Preferences to pre-create any folder in the user profile that you wish to include in the redirections.xml file.

Whenever adding an <include> to the redirections.xml file, always pre-create the included folder.

UWP Applications

UWP applications have been around for a while now and are stored centrally in C:\Program Files\WindowsApps and C:\Windows\SystemApps. Each user receives a copy of the UWP application which is stored in %LOCALAPPDATA%\Packages.

In the past, personalisation of UWP applications was not necessary as they rarely stored important user data and would regenerate at logon if excluded from the User Profile.

As mentioned in the previous section, the Start Menu and Teams user data is stored in subfolders of %LOCALAPPDATA%\Packages. Undoubtedly more 'New' apps in the future will reside here so an include is required.

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated 2024-10-14 -->
<FrxProfileFolderRedirection ExcludeCommonFolders="128">
<Excludes>
<Exclude Copy="0">AppData\Local</Exclude> <Exclude Copy="0">AppData\Local\Microsoft\OneAuth</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\IdentityCache</Exclude>
</Excludes>
<Includes>
<Include>AppData\Local\Packages</Include>
</Includes>
</FrxProfileFolderRedirection>

Ensure that you have pre-created the AppData\Local\Packages folder in the Default User profile or using Group Policy folder extensions.

If you implement the above redirections.xml without pre-creating the user profile folders, new user logons will result in multiple failures related to UWP applications. You probably won't see all UWP apps in the Start Menu, if the Stat Menu does not break. Multiple AppModel-State and AppXDeployment-Server errors will be logged.

You can ignore any errors related to Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy as this is never roamed by FSLogix based on Microsoft guidance.

You can reduce the number of UWP applications by deprovisioning them from the master image. The following UWP applications are present in Windows 11 24H2.

UWP Application

Recommendation

Clipchamp.Clipchamp  
Microsoft.ApplicationCompatibilityEnhancements  
Microsoft.AV1VideoExtension  
Microsoft.AVCEncoderVideoExtension  
Microsoft.BingNews Remove
Microsoft.BingSearch Remove
Microsoft.BingWeather Remove
Microsoft.GamingApp Remove
Microsoft.GetHelp Remove
Microsoft.HEIFImageExtension
Microsoft.HEVCVideoExtension
Microsoft.MicrosoftEdge.Stable
Microsoft.MicrosoftOfficeHub Remove
Microsoft.MicrosoftSolitaireCollection Remove
Microsoft.MicrosoftStickyNotes
Microsoft.MPEG2VideoExtension
Microsoft.OutlookForWindows Remove
Microsoft.Paint
Microsoft.PowerAutomateDesktop Remove
Microsoft.RawImageExtension
Microsoft.ScreenSketch
Microsoft.StorePurchaseApp Remove
Microsoft.Todos
Microsoft.VP9VideoExtensions
Microsoft.WebMediaExtensions
Microsoft.WebpImageExtension
Microsoft.Windows.DevHome Remove
Microsoft.Windows.Photos
Microsoft.WindowsAlarms
Microsoft.WindowsCalculator
Microsoft.WindowsCamera
Microsoft.WindowsFeedbackHub Remove
Microsoft.WindowsNotepad Remove. Create a shortcut to C:\Windows\Notepad.exe in C:\ProgramData\Microsoft\Windows\Start Menu\Programs
Microsoft.WindowsSoundRecorder
Microsoft.WindowsStore Remove
Microsoft.WindowsTerminal Remove
Microsoft.Xbox.TCUI Remove
Microsoft.XboxGamingOverlay Remove
Microsoft.XboxIdentityProvider Remove
Microsoft.XboxSpeechToTextOverlay Remove
Microsoft.YourPhone Remove
Microsoft.ZuneMusic Remove
MicrosoftCorporationII.QuickAssist Remove
MicrosoftWindows.Client.WebExperience Remove
MicrosoftWindows.CrossDevice Remove
MSTeams  
Microsoft.OneDriveSync  

Function RemAppx { Param ([string]$packname)
$fullname=(Get-AppxProvisionedPackage -Online | Where-Object {$_.displayname -eq $packname}).packagename
Remove-AppxProvisionedPackage -Online -AllUsers -PackageName $fullname
Remove-AppxPackage -AllUsers -Package $fullname }

E.g. RemAppx MicrosoftWindows.CrossDevice

Default Exclusions

By default, FSLogix 2210 hotfix 4 (2.9.8884.27471) excludes the following folders. (not exhaustive)

AppData\Local\Microsoft\Credentials
AppData\Local\Microsoft\Internet Explorer\TabRoaming
AppData\Local\Microsoft\Office\16.0\OfficeFileCache
AppData\Local\Microsoft\PlayReady\Internet Explorer\Desktop
AppData\Local\Microsoft\Windows\History\Low\History.IE5
AppData\Local\Microsoft\Windows\IECompatCache\Low
AppData\Local\Microsoft\Windows\IECompatUaCache\Low
AppData\Local\Microsoft\Windows\INetCache
AppData\Local\Microsoft\Windows\Temporary Internet Files
AppData\Local\Microsoft\Windows\Cookies
AppData\Roaming\Credentials
AppData\Roaming\Internet Explorer\UserData\Low
AppData\Roaming\Protect\<USER SID>

The following additional folders are excluded.

Known Issues - FSLogix | Microsoft Entra ID

UWP Application sub folders are also excluded.

Issues with AppX, MSIX or Microsoft store applications - FSLogix | Non-Roamable folders

The Recycle Bin may be excluded using Group Policy. Configuration Settings - FSLogix | RoamRecycleBin

Temp, TMP and InetCache may be excluded using Group Policy. Configuration Settings - FSLogix | SetTemptoLocalPath

Further exclusions may be applied by manipulating the ExcludeCommonFolders parameter in redirections.xml.

Custom profile redirections.xml - FSLogix | Microsoft Learn

If using traditional Windows Folder Redirection, do not exclude any Common User folders, which simply leaves a value of 128 to exclude AppData\LocalLow.

If using OneDrive, you must not implement Windows Folder Redirection of Desktop, Documents or Pictures.

Redirect and move Windows known folders to OneDrive - SharePoint in Microsoft 365 | Microsoft Learn

A known issue exists with FSLogix 2210 HF4

Known Issues - FSLogix | LocalCache & TempState

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated 2024-10-14 -->
<FrxProfileFolderRedirection ExcludeCommonFolders="128">
<Excludes>
<Exclude Copy="0">AppData\Local</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\OneAuth</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\IdentityCache</Exclude>
<Exclude Copy="0">AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\TempState</Exclude>
<Exclude Copy="0">AppData\Local\Packages\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\TempState</Exclude>

</Excludes>
<Includes>
<Include>AppData\Local\Packages</Include>
<Include>AppData\Local\Publishers\8wekyb3d8bbwe\TeamsSharedConfig</Include>
</Includes>
</FrxProfileFolderRedirection>

User file associations and COM information is stored in AppData\Local\Microsoft\Windows\usrclass.dat.

If you wish to retain this information then an include is required for AppData\Local\Microsoft\Windows. There are multiple unnecessary subfolders, therefore exclusions are also required.

App Execution Aliases are stored in AppData\Local\Microsoft\WindowsApps and should be retained.

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated 2024-10-14 -->
<FrxProfileFolderRedirection ExcludeCommonFolders="128">
<Excludes>
<Exclude Copy="0">AppData\Local</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\OneAuth</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\IdentityCache</Exclude>
<Exclude Copy="0">AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\TempState</Exclude>
<Exclude Copy="0">AppData\Local\Packages\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\TempState</Exclude>

<Exclude Copy="0">AppData\Local\Microsoft\Windows\0</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\1033</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\ActionCenterCache</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\AppCache</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\Application Shortcuts</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\Burn</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\CloudStore</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\Explorer</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\GameExplorer</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\Notifications</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\Ringtones</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\Safety</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\SchCache</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Windows\WER</Exclude>

</Excludes>
<Includes>
<Include>AppData\Local\Packages</Include>
<Include>AppData\Local\Publishers\8wekyb3d8bbwe\TeamsSharedConfig</Include>

<Include>AppData\Local\Microsoft\Windows</Include>
<Include>AppData\Local\Microsoft\WindowsApps</Include>
</Includes>
</FrxProfileFolderRedirection>

Microsoft Apps 365 / Office 365

You can use FSLogix ODFC containers to personalise specified Office applications however this article will focus on the use of FSLogix Profile Containers.

If excluding AppData\Local from the profile container and configuring Microsoft Outlook Exchange mailbox caching, by default the cache is stored in AppData\Local\Microsoft\Outlook.

Either add an include to the redirections.xml file

<Include>AppData\Local\Microsoft\Outlook</Include>

or using Group Policy you can redirect the cache to a preserved profile folder

User Configuration - Policies - Administrative Templates - Microsoft Outlook 2016/Miscellaneous/OST Settings

Default location for OST files: %APPDATA%\Microsoft\Outlook

Similarly the Offline Address Book, Quick Access Toolbar and Ribbon Customisations may be redirected to %AppData%

User Configuration - Policies - Administrative Templates - Microsoft Office 2016/Global Options/Customize

Allow roaming of all user customization: Enabled

User Configuration - Policies - Administrative Templates - Microsoft Outlook 2016/Account Settings/E-mail

Specify Offline Address Book path

Offline Address Book path: %APPDATA%\Microsoft\Outlook\OAB

Redirect Licensing Activation information

Computer Configuration - Policies - Administrative Templates - Microsoft Office 2016 (Machine)/Licensing Settings

    Specify the location to save the licensing token used by shared computer activation

    Folder location: %APPDATA%\Microsoft\Office\16.0\Licensing

Overview of shared computer activation for Microsoft 365 Apps - Microsoft 365 Apps | Microsoft Learn

Consider restricting the size of the Outlook Cache. The default setting is 12 Months.

User Configuration - Policies - Administrative Templates - Microsoft Outlook 2016/Accounts/Exchange/Cached Exchange Mode

Cached Exchange Mode Sync Settings

Do not enable

User Configuration - Policies - Administrative Templates - Microsoft Outlook 2016/Accounts/Exchange/Cached Exchange Mode

Cached Exchange Mode (File | Cached Exchange Mode)

Use Cached Exchange Mode for new and existing Outlook profiles

As described in Configuration Settings - FSLogix | OutlookCachedMode, enable OutlookCachedMode and let FSLogix manage the Cache settings

Microsoft Teams 'New' / v2

New Microsoft Teams for Virtualized Desktop Infrastructure (VDI) - Microsoft Teams | Profile Cache Location

As AppData\Local\Packages and subfolders are included, a separate include for AppData\Local\Packages\MSTeams_8wekyb3d8bbwe is not required.

If using the Outlook Teams meeting Addin, an include is required for

<Include>AppData\Local\Publishers\8wekyb3d8bbwe\TeamsSharedConfig</Include>

Microsoft recommend excluding the following folders

<Exclude Copy="0">AppData\Local\Publishers\8wekyb3d8bbwe\TeamsSharedConfig\meeting-addin</Exclude>
<Exclude Copy="0">AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\Logs</Exclude>
<Exclude Copy="0">AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\PerfLog</Exclude>
<Exclude Copy="0">AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\WV2Profile_tfw\WebStorage</Exclude>
<Exclude Copy="0">AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\WV2Profile_tfw\GPUCache</Exclude>
<Exclude Copy="0">AppData\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\TempState</Exclude>

New Microsoft Teams for Virtualized Desktop Infrastructure (VDI) - Microsoft Teams | Recommended Exclusions

Further folders may be evaluated for exclusion

<Exclude>AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\WV2Profile_tfw\IndexedDB</Exclude>
<Exclude>AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\WV2Profile_tfw\Cache</Exclude>
<Exclude>AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\WV2Profile_tfw\Service Worker\CacheStorage</Exclude>
<Exclude>AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\WV2Profile_tfw\Code Cache</Exclude>

New Microsoft Teams for Virtualized Desktop Infrastructure (VDI) - Microsoft Teams | Further Exclusions

OneDrive for Business

OneDrive for Business settings are stored in HKCU\SOFTWARE\Microsoft\OneDrive and AppData\Local\Microsoft\OneDrive\Settings.

Personal OneDrive files are stored in %USERPROFILE%\OneDrive.

OneDrive for Business files by default are stored in %USERPROFILE%\OneDrive-<COMPANYNAME>.

An include is required to retain OneDrive for Business configuration settings.

An include is not required to retain the OneDrive for Business files as folders in the profile root are not excluded. If you modify the default location of the OneDrive for Business files, then create an include if the location is a subfolder of an excluded folder.

<Include>AppData\Local\Microsoft\OneDrive\Settings</Include>

Windows folder redirection must not be in place for the known folders Desktop, Documents and Pictures.

Recommended Group Policy Settings

  • Prevent users from changing the location of their OneDrive folder: Enabled: %USERPROFILE%
  • Prevent Users from syncing personal OneDrive accounts: Enabled
  • Allow syncing of OneDrive accounts for only specific organisations: Enabled: <Tenant-ID>
  • Use OneDrive Files on-Demand

Windows Search

Since the release of Windows Server 2019 and Windows 10 Build 1809, the per-user search database is located in AppData\Roaming\Microsoft\Search\Data\Applications.

No includes are required as all of AppData\Roaming is not excluded from the profile container.

Growth of the search database maybe restricted by configuring Group Policy options to restrict the locations and types of indexed files and folders.

Google Chrome

Google settings, bookmarks, passwords etc are located in AppData\Local\Google\Chrome\User Data\<Profile>

First run settings are stored in AppData\Local\Google\Chrome\User Data

Subfolders of AppData\Local\Google\Chrome\User Data and AppData\Local\Google\Chrome\User Data\<Profile> can grow significantly.

An include should be configured to retain user data and settings.

<Include>AppData\Local\Google\Chrome\User Data</Include>

Excludes should be configured for folders that are not required and can grow significantly.

<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\BrowserMetrics</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\CertificateRevocation</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Crashpad</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Crowd Deny</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Default\Cache</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Default\Code Cache</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Default\GPUCache</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Default\Service Worker</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\MEIPreload</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\OriginTrials</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\PepperFlash</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\pnacl</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\RecoveryImproved</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\Safe Browsing</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\SafetyTips</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\ShaderCache</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\SSLErrorAssistant</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\SwReporter</Exclude>
<Exclude Copy="0">AppData\Local\Google\Chrome\User Data\WidevineCdm</Exclude>

Alternatively the entire folder structure for Google Chrome may be discarded at logoff by implementing Google Chrome Roaming Profiles.

No excludes are required as subfolders of AppData\Local are not retained.

The roaming profile data includes: "bookmarks", "preferences", "passwords", "autofill", "themes", "typedUrls", "extensions", "apps", "tabs", "wifiConfigurations" and is stored in a file named profile.db

Group Policy Settings

User Configuration - Policies - Administrative Templates - Google Chrome

Enable the creation of roaming copies for Google Chrome profile data: Enabled

By default the Chrome profile will be stored in AppData\Roaming\chrome-profile\Default\profile.db.

The profile data may be redirected to a network location by configuring

User Configuration - Policies - Administrative Templates - Google Chrome

Set the roaming profile directory: \\server\share\${user_name}

Microsoft Edge

Edge settings, bookmarks, passwords etc are located in AppData\Local\Microsoft\Edge\User Data\<Profile>

First run settings are stored in AppData\Local\Microsoft\Edge\User Data

Subfolders of AppData\Local\Microsoft\Edge\User Data and AppData\Local\Microsoft\Edge\User Data\<Profile> can grow significantly.

An include should be configured to retain user data and settings.

<Include>AppData\Local\Google\Chrome\User Data</Include>

Excludes should be configured for folders that are not required and can grow significantly.

<Exclude Copy="0">AppData\Local\Microsoft\Edge\User Data\Default\Cache</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Edge\User Data\Default\Code Cache</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Edge\User Data\Default\GPUCache</Exclude>
<Exclude Copy="0">AppData\Local\Microsoft\Edge\User Data\Default\Service Worker</Exclude>

Alternatively the entire folder structure for Microsoft Edge may be discarded at logoff by implementing Microsoft Edge and Enterprise State Roaming | Microsoft Learn.

No excludes are required as subfolders of AppData\Local are not retained.

The roaming profile data includes: "favorites", "settings", "passwords", "addressesAndMore", "extensions", "history", "openTabs", and "collections"

Edge user data may either be stored in the cloud by implementing Microsoft Edge enterprise sync for devices that are Entra (hybrid) joined or

Edge user data may be stored in a roaming profile.db file by implementing On-premises sync for Active Directory (AD) users.

Downloads

The Downloads folder can cause profile bloat over time.

It may be excluded from the Profile Container by modifying the ExcludeCommonFolders attribute in the redirections.xml file.

or a logoff script may be implemented to delete files from the Downloads folder that are over a certain age.

#### Clear redirected downloads folder at logoff to prevent wasting space

# get the date
$cdate=get-date
# get the date minus 7 days (adjust as necessary)
$pdate=$cdate.AddDays(-7)

# Get the Downloads Directory
%{
try { $DL=(New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path }
catch {}
}

# remove all files from downloads older than x days
%{
try { if ($DL) { Get-ChildItem -Path "$DL" -Recurse | Where-Object {$_.LastWriteTime -lt $pdate} | Remove-Item -force -recurse -ErrorAction SilentlyContinue } }
catch {}
}

Logoff Script

As well as cleaning the Downloads folder, a logoff script may be used to clean registry entries and temporary files.

Function Delreg {Param ([string]$regPath)
try { Remove-Item -Path $regPath -Recurse -Force -ErrorAction SilentlyContinue }
catch {}
}

Delreg "HKCU:\SOFTWARE\Microsoft\IdentityCRL"
Delreg "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AAD"
Delreg "HKCU:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WorkplaceJoin"

# Remove temporary profile root files
Get-ChildItem -Path $env:USERPROFILE -Filter *.dat.log* -Force | remove-item -force
Get-ChildItem -Path $env:USERPROFILE -Filter *.tm.blf –Force | remove-item -force
Get-ChildItem -Path $env:USERPROFILE -Filter *.regtrans-ms –Force | remove-item -force

# Remove temporary folders
Get-Item -Path $env:USERPROFILE\SomeFolder -Force | Remove-Item -Force -Recurse

ODFC Containers

This article has not addressed ODFC Containers which can include data for:

Office Activation
OneDrive
OneNote
Outlook
Sharepoint
Skype
Teams

Separating Office data from Profile data can be useful if Office data becomes corrupted allowing the ODFC container to be deleted while retaining Profile data. It also redirects large amounts of data away from the Profile container.

   

 



Cookie Policy: We do NOT use cookies.