locked
Query user apps for App-V client, can it be done? RRS feed

  • Question

  • Hi!

    I'm trying to build a small GUI app for users to be able to clear their personal app settings. I'm using the App-V 4.5 for terminal services client.

    I thought it would be an easy task using wmi (achieving the same function as sftmime) by simply listing the apps the user had access to and then invoke the clear command. Seems the WMI objects doesn't honour the users permissions like sftmime does hence listing all apps in the cache rather than the ones the user have access to. Anyone else come across noticed this difference?

    Command that honour the user permissions (only listing users apps):

    sftmime.exe /query obj:app /short 
     
    wmi query that I thought would produce the same output (vb script format for forum convenience):
     
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\microsoft\appvirt\client")
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM Application",,48)
    For Each objItem in colItems
        Wscript.Echo "-----------------------------------"
        Wscript.Echo "Application instance"
        Wscript.Echo "-----------------------------------"
        Wscript.Echo "Name: " & objItem.Name
    Next
     
     
    http ref: http://technet.microsoft.com/en-us/library/cc817118.aspx

    I understand the sftmime command could be used to create a text file and then parsed line by line but it's not pretty in my oppinion and requires file write permissions and clean up etc.

    Also anyone tried to pick up the output using sftmime with process.start() in .Net with RedirectStandardOutput when using the /console switch succesfully?

    I've been looking for API:s or .Net support for using App-V client functions but I can find any? Is there a SDK for the App-V client?

    Suggestions much appreciated!
    Friday, February 26, 2010 11:33 PM

Answers

  • Hi,

    did you have a look at our App-V Self Support Tools at  http://www.loginconsultants.com/index.php?option=com_docman&task=doc_details&gid=53&Itemid=149 ?

    I think it would meet your requirements of giving Users the possibility to delete their cache (and something more).

    Howeverr, it was released a few days before App-V 4.6 was released and therefor it is only supported on App-V 4.5 today (but you may expect an update quite soon..)

    Cheers

    Falko


    Falko
    • Proposed as answer by znack Tuesday, March 2, 2010 1:37 PM
    • Marked as answer by Jonnw Tuesday, March 2, 2010 2:02 PM
    Monday, March 1, 2010 2:39 PM
    Moderator
  • Hi!

    Thanks Falko but I was acctually able to finish my own app before I read your post.

    If anyone wants source code let me know!

    Thanks
    • Marked as answer by Jonnw Tuesday, March 2, 2010 2:02 PM
    Tuesday, March 2, 2010 2:01 PM

All replies

  • Have you read this whitepaper? App-V Extensibility Today Before the SDK http://download.microsoft.com/download/f/7/8/f784a197-73be-48ff-83da-4102c05a6d44/App-V_Extensibility_Today_Before_the_SDK.docx

    WMI support in App-V is currently read-only, you won't be able to manipulate the client itself.
    Saturday, February 27, 2010 11:40 AM
    Moderator
  • Aaron is correct - the App-V WMI provider does not have methods exposed to make any client changes. 

    And no, there is no Client API other than the sftmime and sfttray utilities.  Be aware that when using sftmime, the user needs permissions for the action.  So if you use the standard permissions (settable by an admin in the App-V Client Console), then the user does not have the permission needed to "clear" an application.

    But to the query issue, the App-V WMI provider runs under the local system context and thus sees everyting.  The WMI Interface provides no ability to specifiy which user and does not look at the user calling context anyway.  So a query will return all apps known to that client.

    It is possible to determine what apps the client knows about on a per user basis by using the WMI remote registry interface.  You wouldn't be able to perform actions like clear from their either, but if you want a WMI based per user query there is a way.

    I have done a lot with the sftmime in scripting, (although not with .Net which I assume means powershell) and following the documentation in the SDK works just fine.
    Saturday, February 27, 2010 2:34 PM
    Moderator
  • Hi guys!

    Thanks for your quick responses...Aaron I understand that WMI is read only hence I only intended to use it for reading! I understand that my initial post was a bit "blur" in describing what I intended to do.

    This is what I intend(ed) to build...

    App for interactive logged in user available on the start menu or suitable location.

    1. Language of choice .Net Winform app that the user starts, it runs the WMI query on startup
    2. The output from the WMI query is put into the GUI (Listbox control with checkboxes),  showing appname and version.
    3. For each application that the user checked (guess it would only be one app most of the time, the one with problems) I would use createprocess for sftmime.exe /clear with appname and version from the GUI and therefore giving the user a self service function to clear personal settings.

    Giving the user clear permissions doesn't seem like a severe security problem since the manual says...

    "SFTMIME CLEAR APP:application [/LOG log-pathname | /CONSOLE | /GUI]
    Clears the current user's settings and publishing configurations for an application"

    Since this approach seems like epic fail with WMI I thought maybe I can pick up the output from sftmime query by reading the actual output that is sent to the console...

    When UseShellExecute is set to false and redirectstandardoutput set to true for a typical console application one should be able to read the console  by using a stream reader and read output (at least MS suggests that). That's why I asked if someone thought about heading down that road. I haven't really given up on that path just yet.

    Code snippet for that

    Dim myProcess As Process = New Process()
    Dim s as string
    myProcess.StartInfo.FileName = "C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe"
    myProcess.StartInfo.UseShellExecute = False
    myProcess.StartInfo.CreateNoWindow = False
    myProcess.StartInfo.RedirectStandardInput = False
    myProcess.StartInfo.RedirectStandardOutput = True
    myProcess.StartInfo.RedirectStandardError = False
    myProcess.StartInfo.Arguments = "/query obj:app /short /console"
    myProcess.Start()

    Dim sOut As StreamReader = myProcess.StandardOutput
    s = sOut.ReadToEnd()

    Hmm, after more carefully reviewing the document Aaron posted it acctually says..."SFTMIME.EXE in App-V 4.5 has changed to support globalization. SFTMIME now writes directly to the console instead of stdout". So trying to pick up stdout is pointless then I suppose.

    I'll give it a shoot with WMI remote registry interface then. Would have been nice just to kick a bit of unmanaged code for the query part :)

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    • Edited by Jonnw Monday, March 1, 2010 2:32 PM Read Aarons doc ref again!
    Monday, March 1, 2010 7:51 AM
  • Hi,

    did you have a look at our App-V Self Support Tools at  http://www.loginconsultants.com/index.php?option=com_docman&task=doc_details&gid=53&Itemid=149 ?

    I think it would meet your requirements of giving Users the possibility to delete their cache (and something more).

    Howeverr, it was released a few days before App-V 4.6 was released and therefor it is only supported on App-V 4.5 today (but you may expect an update quite soon..)

    Cheers

    Falko


    Falko
    • Proposed as answer by znack Tuesday, March 2, 2010 1:37 PM
    • Marked as answer by Jonnw Tuesday, March 2, 2010 2:02 PM
    Monday, March 1, 2010 2:39 PM
    Moderator
  • Hi!

    Thanks Falko but I was acctually able to finish my own app before I read your post.

    If anyone wants source code let me know!

    Thanks
    • Marked as answer by Jonnw Tuesday, March 2, 2010 2:02 PM
    Tuesday, March 2, 2010 2:01 PM