locked
Copy file from VE to local machine RRS feed

  • Question

  • Hi All,

    I need to copy few files from virtual environment to local machine.

    Can you please tell me how can I copy files to local machines from VE during publishing?

    If I run vbs/ps scripts, how can I access VE paths and write the command in it?(e.g. [{ProgramFilesX86}] is not standard variable for vbs). So in that case how can I access the virtual path through vbs/ps scripts  and copy files from VE to local machine?

    Thanks,

    Roy

    Friday, February 12, 2016 10:33 AM

Answers

  • Why not open the virtual environment and just write your files?

    :: ===========================================================================================================
    ::
    :: Created by:		Trentent Tye
    ::			Intel Server Team
    ::			IBM Canada Ltd.
    ::
    :: Creation Date:	Nov 20, 2013
    ::
    :: File Name:		runme.cmd
    ::
    :: Description:		Launches MetaVision Package
    ::                      
    ::
    :: ===========================================================================================================
    
    @ECHO OFF
    CLS
    SET APPVVE=/appvve:c0976e50-0b44-432a-9cfd-5dd37e0eba4a_66074477-65e7-47ac-93e7-515dc413d0a0
    
         > "%TEMP%\1.cmd" ECHO @ECHO OFF
        >> "%TEMP%\1.cmd" ECHO copy /y \\fileserver\fileshare\config.ini "C:\Program Files (x86)\MetaVision"
        >> "%TEMP%\1.cmd" ECHO cd "C:\Program Files (x86)\MetaVision"
        >> "%TEMP%\1.cmd" ECHO START "" "C:\Program Files (x86)\MetaVision\MetaVision.exe"
    
    C:\Windows\System32\cmd.exe /c "%TEMP%\1.cmd" %APPVVE%


    Ack, I read it wrong, this will copy files *into* the virtual environment.

    Extracting files still isn't too difficult if you know what you are looking for.  Easiest method could  be to do the reverse:  

    :: ===========================================================================================================
    ::
    :: Created by:		Trentent Tye
    ::			Intel Server Team
    ::			IBM Canada Ltd.
    ::
    :: Creation Date:	Nov 20, 2013
    ::
    :: File Name:		runme.cmd
    ::
    :: Description:		Launches MetaVision Package
    ::                      
    ::
    :: ===========================================================================================================
    
    @ECHO OFF
    CLS
    SET APPVVE=/appvve:c0976e50-0b44-432a-9cfd-5dd37e0eba4a_66074477-65e7-47ac-93e7-515dc413d0a0
    
         > "%TEMP%\1.cmd" ECHO @ECHO OFF
        >> "%TEMP%\1.cmd" ECHO copy /y "C:\Program Files (x86)\MetaVision" \\fileserver\fileshare\config.ini 
        >> "%TEMP%\1.cmd" ECHO cd "C:\Program Files (x86)\MetaVision"
        >> "%TEMP%\1.cmd" ECHO START "" "C:\Program Files (x86)\MetaVision\MetaVision.exe"
    
    C:\Windows\System32\cmd.exe /c "%TEMP%\1.cmd" %APPVVE%
    Or since your program should be static since you are publishing just do a deploymentconfig.xml script that does your copy.
    • Edited by TrententMVP Friday, February 12, 2016 5:58 PM Read the question wrong
    • Proposed as answer by Vigneshwaran (MCTS)MVP Sunday, February 14, 2016 10:45 AM
    • Marked as answer by royambar Thursday, February 18, 2016 11:05 AM
    Friday, February 12, 2016 5:52 PM

All replies

  • In PS, you can use $PSScriptRoot which will fetch the directory where the script exists. For example: If you have added this in your PS and placed it in scripts folder in sequencer and when publishing the powershell will take the 

    C:\ProgramData\App-V\ProductID\VersionId\Scripts as value. From here you can easily traverse.

    Or place the script in the folder from where you need to copy the files to local drive.Eg: If you place the script in Programfiles in sequencer, when publishing the script will take

    C:\ProgramData\App-V\ProductID\VersionId\Root\VFS\ProgramFiles as root path.


    (Please click on Vote as Helpful and/or Mark as Answer, if it has helped you.)

    Wish to add MVP behind my name :)

    app2pack.blogspot.com: app2pack.blogspot.com

    Friday, February 12, 2016 11:19 AM
  • Why not open the virtual environment and just write your files?

    :: ===========================================================================================================
    ::
    :: Created by:		Trentent Tye
    ::			Intel Server Team
    ::			IBM Canada Ltd.
    ::
    :: Creation Date:	Nov 20, 2013
    ::
    :: File Name:		runme.cmd
    ::
    :: Description:		Launches MetaVision Package
    ::                      
    ::
    :: ===========================================================================================================
    
    @ECHO OFF
    CLS
    SET APPVVE=/appvve:c0976e50-0b44-432a-9cfd-5dd37e0eba4a_66074477-65e7-47ac-93e7-515dc413d0a0
    
         > "%TEMP%\1.cmd" ECHO @ECHO OFF
        >> "%TEMP%\1.cmd" ECHO copy /y \\fileserver\fileshare\config.ini "C:\Program Files (x86)\MetaVision"
        >> "%TEMP%\1.cmd" ECHO cd "C:\Program Files (x86)\MetaVision"
        >> "%TEMP%\1.cmd" ECHO START "" "C:\Program Files (x86)\MetaVision\MetaVision.exe"
    
    C:\Windows\System32\cmd.exe /c "%TEMP%\1.cmd" %APPVVE%


    Ack, I read it wrong, this will copy files *into* the virtual environment.

    Extracting files still isn't too difficult if you know what you are looking for.  Easiest method could  be to do the reverse:  

    :: ===========================================================================================================
    ::
    :: Created by:		Trentent Tye
    ::			Intel Server Team
    ::			IBM Canada Ltd.
    ::
    :: Creation Date:	Nov 20, 2013
    ::
    :: File Name:		runme.cmd
    ::
    :: Description:		Launches MetaVision Package
    ::                      
    ::
    :: ===========================================================================================================
    
    @ECHO OFF
    CLS
    SET APPVVE=/appvve:c0976e50-0b44-432a-9cfd-5dd37e0eba4a_66074477-65e7-47ac-93e7-515dc413d0a0
    
         > "%TEMP%\1.cmd" ECHO @ECHO OFF
        >> "%TEMP%\1.cmd" ECHO copy /y "C:\Program Files (x86)\MetaVision" \\fileserver\fileshare\config.ini 
        >> "%TEMP%\1.cmd" ECHO cd "C:\Program Files (x86)\MetaVision"
        >> "%TEMP%\1.cmd" ECHO START "" "C:\Program Files (x86)\MetaVision\MetaVision.exe"
    
    C:\Windows\System32\cmd.exe /c "%TEMP%\1.cmd" %APPVVE%
    Or since your program should be static since you are publishing just do a deploymentconfig.xml script that does your copy.
    • Edited by TrententMVP Friday, February 12, 2016 5:58 PM Read the question wrong
    • Proposed as answer by Vigneshwaran (MCTS)MVP Sunday, February 14, 2016 10:45 AM
    • Marked as answer by royambar Thursday, February 18, 2016 11:05 AM
    Friday, February 12, 2016 5:52 PM
  • What do you want to accomplish... you say during publishing time, this means your package needs to be in cache, otherwise you can not acces those files in the VE.
    If you for instance want to copy a license file, or whatever at publishing time, I suggest putting it in the "script" folder. This folder makes part of FB0, and will be available as soon as the package is added to the client. The scriptfolder is also the "currentdir" by default if you run add/publish/start/etc scipts.

    As Trentent suggested, let the script run inside the VE, in such a case you do not need to work around the tokenized paths.


    Roy Essers

    Friday, February 12, 2016 11:51 PM
  • I suggest Trentent solution as it is way simpler than any other.

    (Please click on Vote as Helpful and/or Mark as Answer, if it has helped you.)

    Wish to add MVP behind my name :)

    app2pack.blogspot.com: app2pack.blogspot.com

    Sunday, February 14, 2016 10:46 AM