locked
copyfile during adding pakage RRS feed

  • Question

  • Hello,

    I need to copy a file to the syswow64 folder outsite of the virtual environment.
    I tried a batch file and a ps1 script, without luck.

    It looks like a security issue. If I run the script as admin they copy the file, but as I run them from within my dynamicdeployment config the script timed-out.
    tried powershell.exe with the following parameter
    -ExecutionPolicy ByPass -File \\server1\\shares\package\CopyFile.ps1

    running the script as admin works ok, running It logged in with admin and using the add-appvclientpackage  results in the error code
    Add-AppvClientPackage : Embedded Script process exited with an error code indicating failure (return code other than 0).

    the system account has access to the share.

    Anyone got an idea how I can fix this.
    Wednesday, November 19, 2014 1:41 PM

Answers

  • Yes. Put the script in the Scripts folder of the package, and set it to run outside of the virtual environment. The working directory of the script will be the Scripts folder, then you can use the relative path ..\Root\ to access the package files and copy them to SysWOW64.

    If copying to SysWOW64, also make sure you are using the 64-bit Powershell.exe as in the eyes of the 32-bit Powershell.exe, there is no SysWOW64 folder.


    Thursday, November 27, 2014 9:32 AM

All replies

  • What is the return code of your exe (and in turn your ps1)?  While not greatly documented, a non zero exit code will tell the App-V Client the script has failed.  Rollbackenabled will be triggered at that point if you set it to true.
    Wednesday, November 19, 2014 3:41 PM
  • When you run the script in the "AddPackage" part, it's running with the System account. System has no permission to connect to your share providing the PS script. Try to copy CopyFile.ps1 locally on the system and point to this file instead of the share. Hopefully that works...

    Regards, Michael - http://blog.notmyfault.ch -

    • Proposed as answer by RorymonMVP Wednesday, November 19, 2014 4:53 PM
    • Unproposed as answer by RorymonMVP Wednesday, November 19, 2014 4:54 PM
    Wednesday, November 19, 2014 4:00 PM
  • What is in the Script file itself. It seems like you would need to attach this a better package event. May I ask why you did not embed this script with the package. Will it be changing?

    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.”

    Wednesday, November 26, 2014 6:45 PM
  • Hello Steve,

    The script will not change, but the file i need copy needs to be copied to the physical folder and not within the pacakge.
    is is possible to start the script from within the package and then copy a file outside the package?

    Thanks

    Tom

    Wednesday, November 26, 2014 7:51 PM
  • Yes. Put the script in the Scripts folder of the package, and set it to run outside of the virtual environment. The working directory of the script will be the Scripts folder, then you can use the relative path ..\Root\ to access the package files and copy them to SysWOW64.

    If copying to SysWOW64, also make sure you are using the 64-bit Powershell.exe as in the eyes of the 32-bit Powershell.exe, there is no SysWOW64 folder.


    Thursday, November 27, 2014 9:32 AM