Problem:
ProfileDisk VHD or VMDK grows ins size exponentially because of large directory:
c:\users\ProfileDisk\user_name\AppData\Local\Temp
Symptoms:
Large profiledisk for users utilizing non persistent VM desktops.
Possible Resolution(s):
ProfleUnity can redirect %temp% and %tmp% to a local share thus when the VM is refreshed it is deleted.
To address this issue create 5 Application Launcher rules:
Application Launcher Rule 1) Creates ProfileDisk_Temp directory
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c if not exist "%systemdrive%\ProfileDisk_Temp\%username%" mkdir "%systemdrive%\ProfileDisk_Temp\%username%"
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Application Launcher Rule 2) Hides the "ProfileDisk_Temp" directory from user
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c attrib +H "%systemdrive%\ProfileDisk_Temp"
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Application Launcher Rule 3) Redirects variable "%TEMP%" to "ProfileDisk_Temp" directory
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c REG ADD HKCU\Environment /v TEMP /t REG_EXPAND_SZ /d %systemdrive%\ProfileDisk_Temp\%username% /f
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Application Launcher Rule 4) Redirects variable "%TMP%" to "ProfileDisk_Temp" directory
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c REG ADD HKCU\Environment /v TMP /t REG_EXPAND_SZ /d %systemdrive%\ProfileDisk_Temp\%username% /f
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Application Launcher Rule 5) Sets the correct permissions on "ProfileDisk_Temp" directory
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c icacls.exe "%systemdrive%\ProfileDisk_Temp\%username%" /grant "%username%":(OI)(CI)F /inheritance:r & icacls.exe "%systemdrive%\ProfileDisk_Temp\%username%" /grant "system":(OI)(CI)F /inheritance:r & icacls.exe "%systemdrive%\ProfileDisk_Temp\%username%" /grant "administrators":(OI)(CI)F /inheritance:r
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Note: All 4 rules are available for import at the bottom of the article, minus the one above.
(Application Launcher>Lighting button>Import)
Microsoft Teams
Also the profiledisk size on disk may bloat though in session (may not show files), this is because Teams add and deletes data to the Profiledisk VHD causing it to consume blocks on disk.
The following rules need to be added (manually) to your Application Launcher module to redirect MS Teams Temp (service worker) files to local "ProfileDisk_Temp" directory:
Application Launcher Rule for Teams 1) (Teams) Makes a directory if Teams were not executed.
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c if not exist "%appdata%\Microsoft\Teams" mkdir "%appdata%\Microsoft\Teams"
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Application Launcher Rule for Teams 2) (Teams) Makes a local directory for "Service Worker"
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c if not exist "%systemdrive%\ProfileDisk_Temp\%username%\ProU_PD_Excludes\AppData\Local\Microsoft\Teams\Service worker" mkdir "%systemdrive%\ProfileDisk_Temp\%username%\ProU_PD_Excludes\AppData\Local\Microsoft\Teams\Service worker"
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Application Launcher Rule for Teams 3) (Teams) Makes a sim link for Service Worker Directory
- Filespec: %systemroot%\system32\cmd.exe
- Arguments: /c mklink /D "%appdata%\Microsoft\Teams\Service Worker" "%systemdrive%\ProfileDisk_Temp\%username%\ProU_PD_Excludes\AppData\Local\Microsoft\Teams\Service worker"
- Timing: During Configuration Execution
- Hide Progress: True
- Run Async: False
Product Version: 6.x