locked
How to invoke the appv package through powershell script RRS feed

  • Question

  • How to invoke the appv package through powershell script.

    In my case I have UltraVNC (vncviewer.exe) as an application which is sequenced. Now I have written a powershell script. Can someone please let me know is this the right way of calling the appv package? if anyone has any suggestions please let me know.

    #Launch script with by the following commands:
    # powershell.exe -windowstyle hidden path 
    ##################App-V Package Launch Script#################
    # Setup Paramaters to capture variables that are passed to the script. And determine what application and system to launch against.
    Param ( 
    [Parameter(Mandatory=$True)] [ValidateNotNull()] $Var0,
    [Parameter(Mandatory=$True)] [ValidateNotNull()] $Var1,
    )

    # Capture Environment variables
    $username = [Environment]::UserName
     

    function UltraVNC($appvID)
    {
        #setup for UltraVNC APP-V Packages
        $UVNC   = "C:\ProgramData\App-V\"+$appvID+"\Root\vncviewer.exe"
        
        $StdArgs = "/nostatus /nohotkeys /notoolbar /8bit"
       

        IF   ($var0 -eq "UltraVNC") 
        {
            $servername=$var1 + " " + $StdArgs

         
            & $UVNC $servername
           
        }
        ElseIF ($var0 -eq "UltraVNC Training") 
        {
              $servername=$var1 + " " + $StdArgs

              & $UVNCTR $servername 
           
        }

    }

    #Check to see which APP-V Package should be executed.
    IF ($var0 -eq "UltraVNC") 
    {
        $Guid1="834f92f8-2661-4f9c-90c6-14c8676435c7"
        $Guid2="\95a500b4-922d-487e-81a7-556cc42dc330"
        $foldername=$Guid1+$Guid2
        #$appvID ='/appvve:834f92f8-2661-4f9c-90c6-14c8676435c7_95a500b4-922d-487e-81a7-556cc42dc330'
        UltraVNC $foldername
    }

    IF ($var0 -eq "UltraVNC Training") 
    {
        $Guid1="834f92f8-2661-4f9c-90c6-14c8676435c7"
        $Guid2="\95a500b4-922d-487e-81a7-556cc42dc330"
        $foldername=$Guid1+$Guid2
        #$appvID ='/appvve:834f92f8-2661-4f9c-90c6-14c8676435c7_95a500b4-922d-487e-81a7-556cc42dc330'
        UltraVNC $foldername
    }


    Bharath


    Thursday, May 7, 2015 5:53 AM

Answers

  • You can open your appv5 packages by directly calling the executable. The appvve switch is used to hook the appv package into a locally installed application (like cmd.exe).

    Try the following PoSh script
    ((Get-AppvClientPackage *vlc*).GetApplications()).TargetPath

    This will give you back the locations of all applications of your vlc package. You only have to translate the appv5 tokens (like [{ProgramFilesX86}] for instance).
    • Proposed as answer by znack Saturday, May 9, 2015 8:54 AM
    • Edited by Roy Essers Wednesday, May 13, 2015 2:46 PM corrected dash between Get and AppvClientPackage
    • Marked as answer by Brandon RecordsModerator Tuesday, May 26, 2015 4:37 PM
    Thursday, May 7, 2015 7:52 AM
  • Try changing it to

    ((Get-AppvClientPackage *vlc*).GetApplications()).TargetPath

    Looks like the dash was missing between Get and AppvClientPackage

    Tuesday, May 12, 2015 1:59 PM

All replies

  • You can open your appv5 packages by directly calling the executable. The appvve switch is used to hook the appv package into a locally installed application (like cmd.exe).

    Try the following PoSh script
    ((Get-AppvClientPackage *vlc*).GetApplications()).TargetPath

    This will give you back the locations of all applications of your vlc package. You only have to translate the appv5 tokens (like [{ProgramFilesX86}] for instance).
    • Proposed as answer by znack Saturday, May 9, 2015 8:54 AM
    • Edited by Roy Essers Wednesday, May 13, 2015 2:46 PM corrected dash between Get and AppvClientPackage
    • Marked as answer by Brandon RecordsModerator Tuesday, May 26, 2015 4:37 PM
    Thursday, May 7, 2015 7:52 AM
  • Thank you.. but this is not working.


    Thursday, May 7, 2015 8:38 AM
  • Hello,

    I seem to get this to work..?

    Perhaps you can elaborate on your response if you need further assistance?


    Nicke Källén | The Knack| Twitter: @Znackattack

    Saturday, May 9, 2015 8:54 AM
  • Try changing it to

    ((Get-AppvClientPackage *vlc*).GetApplications()).TargetPath

    Looks like the dash was missing between Get and AppvClientPackage

    Tuesday, May 12, 2015 1:59 PM