How to modify the virtual registry using App-V DeploymentConfig and UserConfig

Using the DeploymentConfig and the UserConfig XML files it is possible to modify the virtual registry. There are some points of attention when using this feature. Let’s take a look.

Enabling packaging scripts

When the App-V 5 client is installed the option “EnablePackageScripts” is disabled.

This means that scripts will not be executed when the package is published or launched.

It must be changed when we want to modify the registry through the config scripts.

image

This can be changed using the command: Set-AppvClientConfiguration -EnablePackageScripts $true

image

 

Modifying the DeploymentConfig or the UserConfig

When scripts are enabled we can modify the Config files. I use the UserConfig.xml file and Notepad++ (because it recognizes the XML syntax).

Remove the following lines to enable the registry part of the config file:

image

 

Result:

 

image

 

Now it is possible to modify the registry entries, for example:

 

image

 

Using Variables

The [{AppVCurrentUserSID}] is a variable that will be replaced by the username.

The following variables or tokens are available:

 

AccountPictures C:\Users\<username>\AppData\Roaming\Microsoft\Windows\AccountPictures
Administrative Tools C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
AppData C:\Users\<username>\AppData\Roaming
Application Shortcuts C:\Users\<username>\AppData\Local\Microsoft\Windows\Application Shortcuts
Cache C:\Users\<username>\AppData\Local\Microsoft\Windows\Temporary Internet Files
CD Burning C:\Users\<username>\AppData\Local\Microsoft\Windows\Burn\Burn
Common Administrative Tools C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
Common AppData C:\ProgramData
Common Desktop C:\Users\Public\Desktop
Common Documents C:\Users\Public\Documents
Common Programs C:\ProgramData\Microsoft\Windows\Start Menu\Programs
Common Start Menu C:\ProgramData\Microsoft\Windows\Start Menu
Common Startup C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
Common Templates C:\ProgramData\Microsoft\Windows\Templates
CommonDownloads C:\Users\Public\Downloads
CommonMusic C:\Users\Public\Music
CommonPictures C:\Users\Public\Pictures
CommonRingtones C:\ProgramData\Microsoft\Windows\Ringtones
CommonVideo C:\Users\Public\Videos
Contacts C:\Users\<username>\Contacts
Cookies C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Cookies
CredentialManager C:\Users\<username>\AppData\Roaming\Microsoft\Credentials
CryptoKeys C:\Users\<username>\AppData\Roaming\Microsoft\Crypto
Desktop C:\Users\<username>\Desktop
Device Metadata Store C:\ProgramData\Microsoft\Windows\DeviceMetadataStore
DocumentsLibrary C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Libraries\Documents.library-ms
Downloads C:\Users\<username>\Downloads
DpapiKeys C:\Users\<username>\AppData\Roaming\Microsoft\Protect
Favorites C:\Users\<username>\Favorites
Fonts C:\windows\Fonts
GameTasks C:\Users\<username>\AppData\Local\Microsoft\Windows\GameExplorer
History C:\Users\<username>\AppData\Local\Microsoft\Windows\History
ImplicitAppShortcuts C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts
Libraries C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Libraries
Links C:\Users\<username>\Links
Local AppData C:\Users\<username>\AppData\Local
LocalAppDataLow C:\Users\<username>\AppData\LocalLow
MusicLibrary C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Libraries\Music.library-ms
My Music C:\Users\<username>\Music
My Pictures C:\Users\<username>\Pictures
My Video C:\Users\<username>\Videos
NetHood C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Network Shortcuts
Personal C:\Users\<username>\Documents
PicturesLibrary C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Libraries\Pictures.library-ms
Podcast Library C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Libraries\Podcasts.library-ms
Podcasts C:\Users\<username>\Podcasts
PrintHood C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
Profile C:\Users\<username>
ProgramFiles C:\Program Files
ProgramFilesCommon C:\Program Files\Common Files
ProgramFilesCommonX64 C:\Program Files\Common Files
ProgramFilesCommonX86 C:\Program Files (x86)\Common Files
ProgramFilesX64 C:\Program Files
ProgramFilesX86 C:\Program Files (x86)
Programs C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Public C:\Users\Public
PublicAccountPictures C:\Users\Public\AccountPictures
PublicGameTasks C:\ProgramData\Microsoft\Windows\GameExplorer
PublicLibraries C:\Users\Public\Libraries
Quick Launch C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
Recent C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Recent
RecordedTVLibrary C:\Users\Public\Libraries\RecordedTV.library-ms
ResourceDir C:\windows\resources
Ringtones C:\Users\<username>\AppData\Local\Microsoft\Windows\Ringtones
Roamed Tile Images C:\Users\<username>\AppData\Local\Microsoft\Windows\RoamedTileImages
Roaming Tiles C:\Users\<username>\AppData\Local\Microsoft\Windows\RoamingTiles
SavedGames C:\Users\<username>\Saved Games
Searches C:\Users\<username>\Searches
SendTo C:\Users\<username>\AppData\Roaming\Microsoft\Windows\SendTo
Start Menu C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu
Startup C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
System C:\windows\system32
SystemCertificates C:\Users\<username>\AppData\Roaming\Microsoft\SystemCertificates
SystemX86 C:\windows\SysWOW64
Templates C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Templates
User Pinned C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned
UserProfiles C:\Users
VideosLibrary C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Libraries\Videos.library-ms
Windows C:\windows
Custom Token Custom Token Expansion
AppVAllUsersDir C:\Users\All Users
AppVComputerName <USERNAME>-LT02
AppVCurrentUserSID S-1-5-21-124525095-708259637-1543119021-705252
AppVEnvironmentVariableCommonProgramFiles %commonprogramfiles%
AppVEnvironmentVariableProgramFiles %ProgramFiles%
AppVPackageDrive C:
AppVPackageRoot C:\AppInstallFolder
AppVSystem32Catroot C:\windows\system32\catroot
AppVSystem32Catroot2 C:\windows\system32\catroot2
AppVSystem32DriversEtc C:\windows\system32\drivers\etc
AppVSystem32Driverstore C:\windows\system32\driverstore
AppVSystem32Logfiles C:\windows\system32\logfiles
AppVSystem32Spool C:\windows\system32\spool

 

Example

Let use the variables or tokens in a scenario to test it’s functionality.

This script will write the ComputerName or Hostname to the virtual registry:

 

<Registry Enabled=”true”>
<Include>
<Key Path=”\REGISTRY\USER\[{AppVCurrentUserSID}]\Software\[{AppVComputerName}]\Adobe”>
<Value Type=”REG_SZ” Name=”License” Data=”Number”/>
</Key>
<Key Path=”\REGISTRY\USER\[{AppVCurrentUserSID}]\Software\[{AppVComputerName}]\Adobe”/>
</Include>
</Registry>

 

Save the file.

If the package is already published, first unpublish the file on the client using:

Unpublish-AppvClientPackage -name *

Then re-publish the file using:

Publish-AppvClientPackage -name *appname* -DynamicUserConfigurationPath UserConfig.xml

Now that the package is published using PowerShell, we can check in the virtual registry if the registry key exists.

First, get the GUID of the package using:

Get-AppvClientPackage –Name *app*

22-4-2014 22-02-15

 

Use the PackageID to open the virtual registry using the command:

Regedit.exe /appvve:4a45f14e-34b0-4bf6-89b9-3781b1cab127_2f113a80-3308-48a1-af4c-ae99ebd4b8a1

This will result in the following registry entry in the virtual environment. The ComputerName or Hostname is used in the folder name.

 

image

Advertisements
This entry was posted in App-V. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s