Have batch file run visibly on target computer
I know PDQ deploy is designed to run files silently on the target machines, but I have a situation where I need an batch file which starts a database, to visibly run on the target server so I can see it. I want to run it on a schedule because the database routinely gets disconnected. When I deploy the batch file to the target server, the batch file starts the executable correctly, but the process will run in the background and I can't see it come up. I need to see this exe come up so the database information is visible on the server. Is there any way of defining, whether it's a batch file, executable, whatever, to run "not" in the background and actually come up on the machine?
Comments
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:
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.
Thanks Shane. Unfortunately I'm on version 2. Is there no way to get it to work in 2?
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
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.
is it still possible to do something like this? I've been getting a lot of failed to clean up target directory errors.