none
Trying to grant permissions on a folder during TS.

    Question

  • I have a basic batch file to copy over a folder to C:\.

    Then an exe within that folder is run and an INI file gets copied to another location.

    That all works fine, but I'm trying to grant permissions to that folder as well.

    I was given a batch file that someone runs manually from the desktop and it appears to work fine. When I run it through
    MDT, everything gets done but the permissions. Here's a snippet of the batch file:

    robocopy \mdtserver\share\TN3270Plus C:\TN3270Plus /e /k /I /y /r
    cd C:\TN3270Plus
    START C:\TN3270Plus\TN3270Setup.exe /s /v"/qn ALLUSERS=1"
    icacls "C:\Program Files (x86)\SDI" /grant "Authenticated Users":(OI)(CI)F /t

    The icacls is what I need. If I make just an online-line batch file on the desktop and run it, it adds authenticated users with
    full control to the folder. It does not fail, but does not apply that user within the batch when MDT runs it.
    I've added "runas /user:administrator" to the batch and also net use* with my elevated account.
    Just not finding what I need for this to happen, if anyone knows.....


    • Edited by the1rickster Wednesday, November 7, 2018 4:54 PM
    Wednesday, November 7, 2018 4:53 PM

Answers

  • This is what is working for me. Copying the folder, then copying a file.
    Running the installer from the target pc. Waiting a few seconds before chainging
    permissions on the created folder.
    Share the folder, then grant permissions. Remove share.

    @echo on

    robocopy \\mdtserver\share\TN3270Plus C:\TN3270Plus /e /np /nfl /ndl /njh /njs /nc /ns
    robocopy \\mdtserver\share\TN3270INI "C:\ProgramData\SDI\TN3270 PLUS" /e
    cd C:\TN3270Plus
    START C:\TN3270Plus\TN3270PlusSetup406.EXE /s /v"/qn ALLUSERS=1"
    timeout /T 10 /nobreak
    cd C:\
    net share share="C:\Program Files (x86)\SDI" /grant:"authenticated users",FULL
    icacls "C:\Program Files (x86)\SDI" /grant:r "Authenticated Users":(OI)(CI)F
    net share share /delete
    set/A errlev="%ERRORLEVEL% & 24"
    exit/B %errlev%

    Perfect.... if this helps anyone else.


    • Edited by the1rickster Wednesday, November 7, 2018 9:56 PM
    • Marked as answer by the1rickster Wednesday, November 7, 2018 9:56 PM
    Wednesday, November 7, 2018 6:21 PM

All replies

  • This is what is working for me. Copying the folder, then copying a file.
    Running the installer from the target pc. Waiting a few seconds before chainging
    permissions on the created folder.
    Share the folder, then grant permissions. Remove share.

    @echo on

    robocopy \\mdtserver\share\TN3270Plus C:\TN3270Plus /e /np /nfl /ndl /njh /njs /nc /ns
    robocopy \\mdtserver\share\TN3270INI "C:\ProgramData\SDI\TN3270 PLUS" /e
    cd C:\TN3270Plus
    START C:\TN3270Plus\TN3270PlusSetup406.EXE /s /v"/qn ALLUSERS=1"
    timeout /T 10 /nobreak
    cd C:\
    net share share="C:\Program Files (x86)\SDI" /grant:"authenticated users",FULL
    icacls "C:\Program Files (x86)\SDI" /grant:r "Authenticated Users":(OI)(CI)F
    net share share /delete
    set/A errlev="%ERRORLEVEL% & 24"
    exit/B %errlev%

    Perfect.... if this helps anyone else.


    • Edited by the1rickster Wednesday, November 7, 2018 9:56 PM
    • Marked as answer by the1rickster Wednesday, November 7, 2018 9:56 PM
    Wednesday, November 7, 2018 6:21 PM
  • The above reply is what is finally working!
    • Edited by the1rickster Wednesday, November 7, 2018 9:50 PM
    Wednesday, November 7, 2018 7:20 PM