App_Remediation: New Tool for App-V 5 apps in Roaming Environs

App_Remediation is a new free tool I am releasing to the public today.

App_Remediation is a console application designed to be used with App-V 5 (and above) to save and restore application related data (ARD) between locations that normally do not roam and those that do.

App-V now isolates ARD changes and redirects the saved file changes to locations that either roam or not, based on whether those changes would have roamed if the application was natively installed. This is quite different from the versions of App-V before version 5, where these changes would have been isolated and redirected to a location that always roamed. This remediation of badly constructed apps is very important to customers in a roaming environment, including not only those using “roaming profiles”, but also if using folder redirection, home drives, or other methods.

This program can be used in scripts to remediate virtual applications in two different ways:

  • PER APP BASIS
    Quite possibly, you only have a few apps in production today that require this kind of remediation. A simple solution would be to add this program as the script file for both “StartVirtualEnvironment” and “TerminateVirtualEnvironment”.

    For the StartVirtualEnvironment script, you use the parameter “/restore“, followed by a space, and then followed by the Package Id GUID (not the package version guid, and not inclosed in { } characters). You would mark the script to start outside the virtual environment with rollback=false.

    For the TerminateVirtualEnvironment script, use the parameter “/save“, followed by a space, and then followed by the Package Id GUID.

  • PER USER SESSION BASIS
    The app may also be run as part of user logon / logoff scripts, using the “/saveall” and “/restoreall” parameters. No GUIDs required as it will save or restore all packages found.

HOW IT WORKS

When saving changes, it will copy the folders and files (preserving the attributes, ACLs, and timestamps) from the users AppData/Local redirection repositories into a similar location under the users AppData/roaming location.

For example:
    C:\Users\Tim\AppData\local\Microsoft\AppV\Client\VFS\7EA4C0C9-2099-E743-AAEA-A1C03D11138E
is saved to:
    C:\Users\Tim\AppData\remote\Microsoft\AppV\Client\VFS\SavedFromLocal\7EA4C0C9-2099-E743-AAEA-A1C03D11138E

The program does not touch isolated registry information, as those are properly handled for standard users when apps do not require elevation.

Example Script

Below is an example of use of App_Remediation solving the problem of Paint.Net saving user settings into AppData/Local based files. The Package Id GUID is conveniently found at the top of the Deployment or User config file as PackageId=…

<UserScripts>

    <StartVirtualEnvironment RunInVirtualEnvironment=”false”>
        <Path>C:\Windows\App_Remediation.exe</Path>
        <Arguments>/restore 26ceb0bc-1e69-4de1-a444-70b6f1e0dfc3</Arguments>
        <Wait RollbackOnError=”false” Timeout=”30″/>
    </StartVirtualEnvironment>

    <TerminateVirtualEnvironment>
        <Path>C:\Windows\App_Remediation.exe</Path>
        <Arguments>/save 26ceb0bc-1e69-4de1-a444-70b6f1e0dfc3</Arguments>
        <Wait RollbackOnError=”false” Timeout=”30″/>
    </TerminateVirtualEnvironment>

</UserScripts>

You can also solve this problem with some User Environment Management products, although ironically not Microsoft’s UE-V product. This tool should prove to be easier to use, since you don’t need to worry about the app-specific details of what to capture or not. Just use this and it grabs everything that App-V isolates.

See this page for more information on download and installation.

Author: Tim Mangan

Microsoft MVP for App-V Citrix CTP