Have batch file run visibly on target computer

Comments

5 comments

  • Shane Corellian

    Hi Jonathan,

    Yes. In Deploy 3.0 you can set the Step (in your PDQ Package) to Run as Logged On User.

    If the window that you need to see is a CMD window then you'll need to run a command step like the following:

    START /WAIT <BatchFile>

    If you are calling an EXE then you can just use an Install Step since START /WAIT won't be necessary.

    If the logged on user is not an Administrator (and your batch / install file requires Administrator access) then you will need to upgrade to Deploy 3.1 (currently in beta) and set the Run As value to "Deploy User (Interactive)". 

    See attachments.

     

    0
    Comment actions Permalink
  • Jonathan Runyan

    Thanks Shane.  Unfortunately I'm on version 2.  Is there no way to get it to work in 2?

    0
    Comment actions Permalink
  • Wes

    Is there a way to make the response to the bat file that is run result in an success or error code to stop or continue the deployment with this method?

    Since we can't install software at login, I was hoping to have a bat prompt to ask use if they could close said software and install now(y), which would close the window and continue installation or if it was interrupting important work try again later (n), which would close that window and abort installation.

    I was basing it off this bat.

    @echo off

    SET /P ANSWER=A new version of Firefox needs to be install, please close out and select Y for Yes to proceed. If you cannot close at this time do to client work, select N for No (Y/N)?
    echo You chose: %ANSWER%
    if /i {%ANSWER%}=={y} (goto :yes)
    if /i {%ANSWER%}=={yes} (goto :yes)
    goto :no
    :yes
    echo You pressed yes!
    exit /b 0

    :no
    echo You pressed no!
    exit /b 1

    0
    Comment actions Permalink
  • Shane Corellian

    Assuming you run this step interactively then, yes, something like this would work.

    If you want the deployment to look like a success (even though it was stopped) then you'd need to have the Error Mode option set to Stop Deployment With Success. This means if an error code is returned that is not in the Success Codes field (in the Details tab) then the deployment will end but it will still show a success. Otherwise have the Error Mode for the batch file step set to Stop Deployment with Error.

    Stop_Deployment_With_Success.png

     

    0
    Comment actions Permalink
  • David Chiang

    is it still possible to do something like this? I've been getting a lot of failed to clean up target directory errors. 

    0
    Comment actions Permalink

Please sign in to leave a comment.