locked
App V: Copy file into VFS before launch RRS feed

  • Question

  • I am trying to copy a prefrence file based on computer name into the Q drive before the application is launched, but so far nothing has worked. i have a batch file that gets called that identifies the computer by name and determines which file needs to be copied, but on the actual xcopy command it always returns "0 files copied"

    here is the osd script i am using

    <SCRIPT EVENT="LAUNCH" PROTECT="FALSE" TIMING="PRE" WAIT="TRUE">

    <SCRIPTBODY LANGUAGE="Batch">net use E: \\\hillnet\\software\\prefs\\atrt \n call "\\\\hillnet\\software\\allsitesmaster\\setsite.bat" \n xcopy "E:\\%Site%\\Student.iw" "%SFT_MNT%\\ATRTS\\Student.iw" /o /y /q \n net use E: /delete /y \npause \n

    </SCRIPTBODY>

    </SCRIPT>

    i placed the pause obviously so i could see if the copy actually happens and it doesnt. everything else works except the copy. is there something i am missing?

    the params are being replaced accordingly, so the command that is shown on my test system is 

    xcopy "E:\PMS\Student.iw" "Q:\ATRTS\student.iw" /y /q /o                                                                                                            Invalid drive specification                                                                                                                                                                                0 File(s) copied  

    for clarification, the reason to do this is this applications is used at 20+ schools and uses a school specific pref file for database locations, so i cant include it in the sequencing unless i want to create 20+ sequences for each site with each sites specific pref. not desirable to say the least.

    Thursday, March 1, 2012 8:05 PM

Answers

  • Hello,

    I would rewrite the script - that xcopy command wouldn't work;

    C:\Users\nicke>copy "%CD%\student.i*" "H:\atr\student.i*"
    C:\Users\nicke\student.ini
    The system cannot find the path specified.
            0 file(s) copied.

    C:\Users\nicke>copy "%CD%\student.i*" "H:\atr\student.i*"
    C:\Users\nicke\student.ini
            1 file(s) copied.

    C:\Users\nicke>copy "%CD%\student.i*" "H:\atr\student.i*" /o /y /q
    The syntax of the command is incorrect.

    C:\Users\nicke>xcopy "%CD%\student.i*" "H:\atr\student.i*" /o /y /q
    Access denied
    0 File(s) copied

    C:\Users\nicke>xcopy "%CD%\student.i*" "H:\atr\student.i*" /o /y /q
    Access denied
    0 File(s) copied

    C:\Users\nicke>


     


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


    • Edited by znack Wednesday, March 14, 2012 9:31 PM
    • Marked as answer by Obannon Thursday, March 15, 2012 3:46 PM
    Wednesday, March 14, 2012 9:30 PM

All replies

  • Set PROTECT=TRUE in the OSD, otherwise you'll never see inside the virtual environment.


    Twitter: @stealthpuppy | Blog: stealthpuppy.com

    This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.

    Thursday, March 1, 2012 8:16 PM
    Moderator
  • After making that change, now i get Access denied on the file copy.
    Thursday, March 1, 2012 8:54 PM
  • Have you disabled security descriptors in the package or changed the permissions on the file inside the package?

    Similar threads are available under the Related Topics heading on the right of the page too.



    Twitter: @stealthpuppy | Blog: stealthpuppy.com

    This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.


    Thursday, March 1, 2012 9:03 PM
    Moderator
  • I have reloaded the app and verified that Security Desriptors are disabled and that perms are set properly on the install directory, yet it still gives an access is denied message on the file copy.

    I have searched this issue quite extensively and tried suggestions that i found, but have yet to find a fix for this issue.

    I read that when an app is fully loaded and running, that i should be able to access the install directory(Q:\<app>), is that true? the reason i ask is because i am never able to actually access the Q drive other than in the VM workstation. maybe there is something with that..

    Monday, March 5, 2012 3:56 PM
  • Hello,

    Use this article;

    http://blog.stealthpuppy.com/virtualisation/app-v-faq-27-how-do-i-get-an-application-into-the-app-v-bubble-for-troubleshooting/

    Verify that you can manually copy the file in the destination you want to, verify that you can manually create files in it and review its contents.


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

    Monday, March 5, 2012 4:39 PM
  • I am able to manually copy the file into the Q:\ATRT folder using the SFTTRAY option of loading the app but running CMD.exe instead.
    Monday, March 5, 2012 5:11 PM
  • When you write a script in an OSD file, it essentially parses it and spits out a batch file, then executes it.  What you might try doing is writing a batch file for your script, then call it using SFTTRAY /exe <path to batch file> "<name of package>".  I'd be interested in seeing if it works then.

    <SCRIPTBODY LANGUAGE="Batch">net use E: \\\hillnet\\software\\prefs\\atrt \n

    Also, just a comment, but you have 3 \'s at the start of that path instead of 4.  It probably shouldn't matter (as long as "\h" doesn't mean anything) but you might want to change it anyway for consistency.

    Monday, March 5, 2012 9:03 PM
  • Hello,

    When executing your script - does the E: -mapping exist for the session?


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

    Tuesday, March 6, 2012 7:36 AM
  • @S_Sanchez

    I have tried calling a batch that does the same thing as the script using SFTTRAY but it still gets access denied on the file copy.

    I have also fixed the \'s for consistency

    @znack

    the E drive does get mapped and stays until after the copy has failed, then it removes the mapping.

    Tuesday, March 6, 2012 8:29 PM
  • Hello,
    When you run the XCOPY - why include the file name in the destination folder?


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

    Tuesday, March 6, 2012 9:06 PM
  • the file name being included is just so i know for certain that its named correctly as the program is funky about it being named correctly with correct caps as well. I should probably use the copy command instead, I just get used to using xcopy.

    Tuesday, March 6, 2012 9:47 PM
  • I'd be interested in doing the same in my lab to see what's causing the access denied, so would you mind sharing your script with us here explaining the desired result?

    Thanks

     

    Mohsen Almassud

    Wednesday, March 14, 2012 2:41 AM
  • <SCRIPT EVENT="LAUNCH" PROTECT="TRUE" TIMING="PRE" WAIT="TRUE">
    <SCRIPTBODY LANGUAGE="Batch">
    net use E: \\\\hillnet\\software\\prefs\\atrt \n                           - Maps network location of pref files
    call "\\\\hillnet\\software\\allsitesmaster\\setsite.bat" \n               - batch file that identifies computer name and assigns %Site% param
    xcopy "E:\\%Site%\\Student.i*" "Q:\\ATRT\\ATRTS\\Student.i*" /o /y /q \n   - copies Student.iw file into vfs(Q:\ATRT\ATRTS) folder
    net use E: /delete /y \n                                                   - removes mapping
    pause \n                                                                   - just to see whats happened as my eyes arent that quick 

    </SCRIPTBODY>
    </SCRIPT>


    Everything works except the copying, in that the E drive gets mapped and the %Site% param gets assigned properly, so on my test system
    thats named PO016155678S the copy command displays as

    xcopy "E:\PMS\Student.i*" "Q:\ATRT\ATRTS\Student.i*" /o /y /q

    the file does exist in the location on the network(E:\PMS), just end up getting the Access Denied message after the copy command

    I have tried both ways, like above and using a vbs script to do the copy and then just run the vbs and i get the same results, so not really sure whats blocking the copy. I have removed "Enforce Security Descriptors" in the sequence as well as given modify rights to everyone as well as Domain Users to the VFS directory(Q:\ATRT\).

    Wednesday, March 14, 2012 5:17 PM
  • Hello,

    I would rewrite the script - that xcopy command wouldn't work;

    C:\Users\nicke>copy "%CD%\student.i*" "H:\atr\student.i*"
    C:\Users\nicke\student.ini
    The system cannot find the path specified.
            0 file(s) copied.

    C:\Users\nicke>copy "%CD%\student.i*" "H:\atr\student.i*"
    C:\Users\nicke\student.ini
            1 file(s) copied.

    C:\Users\nicke>copy "%CD%\student.i*" "H:\atr\student.i*" /o /y /q
    The syntax of the command is incorrect.

    C:\Users\nicke>xcopy "%CD%\student.i*" "H:\atr\student.i*" /o /y /q
    Access denied
    0 File(s) copied

    C:\Users\nicke>xcopy "%CD%\student.i*" "H:\atr\student.i*" /o /y /q
    Access denied
    0 File(s) copied

    C:\Users\nicke>


     


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


    • Edited by znack Wednesday, March 14, 2012 9:31 PM
    • Marked as answer by Obannon Thursday, March 15, 2012 3:46 PM
    Wednesday, March 14, 2012 9:30 PM
  • so here's what I found:

    to start with I tried just to do Copy "\\\Server\\Share\\FileName.exe" "Q:\Package path\FileName.exe" \n and of course got the access denied, so I was kind of happy that I am able to reproduce the problem.

    so on the machine that I am using for testing, I changed the sfttray.exe to always run as an administrator for all users, and then tried again, and it worked. I also tried to mimc your script to a degree and it still worked just fine. so I am not sure how this going to help you, but at least you now know the cause of the access denied you've been getting.

    Mohsen.


    Mohsen Almassud

    Wednesday, March 14, 2012 10:44 PM
  • wow, i can not believe that the xcopy was the culprit, after changing to copy, everything is working perfectly.

    Thanks for all the help on this issue as this now sets up the ability to virtualize around 6 or 7 more educational apps that use this type of site specific prefrence file without having to create 20 some site specific sequences.

    Thursday, March 15, 2012 3:46 PM
  • Unless you feel that the command prompt should be disabled for students.  Then you have no solution.  Shouldn't admins do all the installing and configuration and the users just use?
    Thursday, May 17, 2012 4:32 PM
  • as the process is only copying 1 file thats 2kb in size the command window only flashes for less than a second and only upon 1st launch. i use the IF EXIST command so that on subsequent launches it doesnt need to copy the file. The users dont do anything other than click on the program to run.
    Wednesday, May 30, 2012 9:14 PM