Delete Roaming Profiles

Delete Cached Roaming Profiles:

This will enable Windows to delete a cached profile of a roaming user when the user loggs off the system.

<package id="delroamingprofile" name="Delete Roaming Profile" revision="1" reboot="false" priority="1000" timeout="10">
      <check type="registry" condition="equals" 
       path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DeleteRoamingCache" value="1" />
        <install cmd='cmd /C regedit.exe /s "%PACKAGES%\registry\deleteroamingprofile.reg"'></install>
</package>

Where deleteroamingprofile.reg contains:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DeleteRoamingCache"=dword:00000001

The package below eliminates the need of an external registry file and also offers a remove command:

<package id="delroamingprofile" name="Delete Roaming Profile" revision="1" reboot="false" priority="1000" timeout="10">
    <check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DeleteRoamingCache" value="1" />
    <install cmd='reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DeleteRoamingCache /t REG_DWORD /d 1 /f' />
    <remove cmd='reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DeleteRoamingCache /f' />
</package>