locked
Is there a token for AppVClientConnectionGroup / AppVClientPackage GUID? RRS feed

  • Question

  • Hi,

    maybe a simple question but I can't figure it out. I have a few applications I need to copy a specific INI file to using StartProcess and copy it back afterwards with ExitProcess. It works fine but in the script I manually have to get the localtion of the VFS for that specific application. An example is '%LOCALAPPDATA%\Microsoft\AppV\Client\VFS\3ACF30AF-12F8-41B5-9637-D66700DF111A\ProgramFilesX86\<name of the application>. Ofcourse with every application the GUID changes. As I always create a new package, even for an update, these GUIDS change a lot.

    Now I know know I can get PowerShell to retrieve that GUID for me, although I dislike PowerShell for it's execution slowness compared to vbscript for example (and I don't want to discuss that :)). I wonder if there is a token I can use to get the GUID of package and / or connectiongroup? I currently have the token-list as below, but maybe there are additional tokens?

    Known Folder Token

    Known Folder Path

    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

    Thursday, April 30, 2015 12:01 PM

All replies

  • I know this isn't exactly what you are asking...but do you HAVE to run this script outside the VE? The COW location you are referencing shouldn't need to be accessed if you are running from inside the VE because you can simply write to the C:\Program Files\... location if you are running inside.
    But I might be answering my own question if you have to revert the ini back on exit process as you can't run inside the VE on exit.

    As far as the tokens are concerned I don't believe they are usable from inside a script, they are only for use by the App-V client.  For example if you fired up a vbs and wanted to get AppVPackageRoot, you couldn't access that token.  You can do something like pass AppVPackageRoot as a (string) argument to the vbs, but its not something like an environment variable like %SFT_MNT% was in App-V 4.6.

    Thursday, April 30, 2015 2:14 PM
  • As far as the tokens are concerned I don't believe they are usable from inside a script, they are only for use by the App-V client.  For example if you fired up a vbs and wanted to get AppVPackageRoot, you couldn't access that token.  You can do something like pass AppVPackageRoot as a (string) argument to the vbs, but its not something like an environment variable like %SFT_MNT% was in App-V 4.6.

    Actually you can use these tokens, you just have to pass them to your script through the deployment/userconfig. 
    To come back to the question,  afaik there are no token for those sids, but you can retrieve them from AppVPackageRoot.

    Thursday, April 30, 2015 2:30 PM
  • I know this isn't exactly what you are asking...but do you HAVE to run this script outside the VE? The COW location you are referencing shouldn't need to be accessed if you are running from inside the VE because you can simply write to the C:\Program Files\... location if you are running inside.
    But I might be answering my own question if you have to revert the ini back on exit process as you can't run inside the VE on exit.

    As far as the tokens are concerned I don't believe they are usable from inside a script, they are only for use by the App-V client.  For example if you fired up a vbs and wanted to get AppVPackageRoot, you couldn't access that token.  You can do something like pass AppVPackageRoot as a (string) argument to the vbs, but its not something like an environment variable like %SFT_MNT% was in App-V 4.6.

    For StartProcess or StartVirtualEnvironment that works fine, however with ExitProcess and / or TerminalVirtualEnvironment the link to %ProgramFiles(x86)% is already gone when the script runs, even though the virtual environment IS in fact still running. But because of that I can't get that file from the VFS, the directory / link just doesn't exist in C:\Program Files (x86) anymore within the VE that's still running.

    Thursday, April 30, 2015 2:48 PM
  • As far as the tokens are concerned I don't believe they are usable from inside a script, they are only for use by the App-V client.  For example if you fired up a vbs and wanted to get AppVPackageRoot, you couldn't access that token.  You can do something like pass AppVPackageRoot as a (string) argument to the vbs, but its not something like an environment variable like %SFT_MNT% was in App-V 4.6.

    Actually you can use these tokens, you just have to pass them to your script through the deployment/userconfig. 
    To come back to the question,  afaik there are no token for those sids, but you can retrieve them from AppVPackageRoot.

    I indeed use that quite a lot, passing tokens to my scripts. Unfortunately to use the actual VFS folder it's cumbersome to have to hard-code that.
    Thursday, April 30, 2015 2:57 PM
  • I indeed use that quite a lot, passing tokens to my scripts. Unfortunately to use the actual VFS folder it's cumbersome to have to hard-code that.
    I know, but if you do not want to use powershell, passing AppVPackageRoot is your only way; just use a regex or whatever to retrieve the SIDs.
    Thursday, April 30, 2015 3:08 PM
  • OK I hear you.

    What might be the easiest way is to create a wrapper for the program that you execute instead of the actual exe.  So when you launch the wrapper, it edits the ini, then runs (with wait) the actual exe, then after the exe exits it revers the ini back.
    This is a good use case for exit scripts should be able to run inside the VE.  You should create a suggestion, or if you want to add on I created a post for beefed up scripting (shameless plug found here: http://appv.uservoice.com/forums/280448-microsoft-application-virtualization/suggestions/7240266-improve-scripting-options)

    When you pass the token to the VBS, does it evaluate as inside path (C:\Program Files) or outside path ('%LOCALAPPDATA%\Microsoft\AppV\Client\VFS\etc....)?  Just curious, I have only done that once or twice.  I REALLY wish those properties could be evaluated by some generic API call, or were env variables like 4.6.  

    Even if you use powershell you can't evaluate the tokens correct?  You just have access to the cmdlets and can 'build' the value of the tokens yourself right?

    I want to make sure I'm not doing things the hard way.

    Thursday, April 30, 2015 3:29 PM
  • OK I hear you.

    What might be the easiest way is to create a wrapper for the program that you execute instead of the actual exe.  So when you launch the wrapper, it edits the ini, then runs (with wait) the actual exe, then after the exe exits it revers the ini back.
    This is a good use case for exit scripts should be able to run inside the VE.  You should create a suggestion, or if you want to add on I created a post for beefed up scripting (shameless plug found here: http://appv.uservoice.com/forums/280448-microsoft-application-virtualization/suggestions/7240266-improve-scripting-options)

    When you pass the token to the VBS, does it evaluate as inside path (C:\Program Files) or outside path ('%LOCALAPPDATA%\Microsoft\AppV\Client\VFS\etc....)?  Just curious, I have only done that once or twice.  I REALLY wish those properties could be evaluated by some generic API call, or were env variables like 4.6.  

    Even if you use powershell you can't evaluate the tokens correct?  You just have access to the cmdlets and can 'build' the value of the tokens yourself right?

    I want to make sure I'm not doing things the hard way.

    mwa.. that's even using more ducttape than just hardcoding the GUID :) Thanks for the suggestion though. I think I'll make a little sub that finds out the actual VFS path. But until then I'll wait for someone to give the holy-grail answer :)
    Thursday, April 30, 2015 3:58 PM
  • Package Group GUIDs are only for the purposes of ensuring that Catalog and CoW/user Data are converged in the meat virtual environment. Wouldn't it be dangerous to try to do any manipulation to these items out of band from the App-V client itself?

    I'm having a hard time understanding why a script would need to know one from the other. What would be trying to solve or reconsile?


    Steve Thomas, Senior Consultant, Microsoft

    App-V/MED-V/SCVMM/Server App-V/MDOP/AppCompat

    http://blogs.technet.com/gladiatormsft/
    The App-V Team blog: http://blogs.technet.com/appv/
    The MED-V Team Blog: http://blogs.technet.com/medv
    The SCVMM Team blog: http://blogs.technet.com/scvmm/

    “This posting is provided "AS IS" with no warranties, and confers no rights. User assumes all risks.”

    Thursday, May 28, 2015 7:55 PM
  • Steve,

    I believe the OP is attempting to manipulate a COW file (virtualized path under ProgramFilesX86) on exit of an application or the App-V VE as a whole.

    Since ExitProcess and TerminateVirtualEnvrironment both can only run outside the VE, the only way to manipulate that file is by determining the user's COW location, determining the package GUID, and interacting with it from there.
    If ExitProcess or TerminateVirtualEnvrironment had a RunInVirtualEnvironment="true" flag that would do exactly what he wants.

    There are workarounds, I believe he was hoping there was an easier way of doing it.

    Thursday, June 11, 2015 12:52 PM