Using Batch Scripts To Silently Load Applications Before Main Application Starts On XenApp Published App

Hey All -

I'm currently working on an issue that I have a couple of questions about.  I have a XenApp server that hosts a program called GulfPak.  In that application, one feature is to click a button toi launch an email with forms attached.  To get this to work, we have published a batch file instead of the GulfPak executable so that we may map a couple of drives and launch Microsoft Online SignIn Assistant which will automatically configure the current user's email in their roaming profile on the XenApp server.  The user's machines have the applications published, not the desktop so I'm trying to make a few things as silent as possible

The issue that i'm running into is that when they launch the GulfPak application, the batch files runs (as it's supposed to) but it shows the Microsoft Sign-In Assistant and black command windows before getting to GulfPak.  Also - if they exit out of GulfPak and get back into it, since MS Signin is already running on the server (because they are in the same session) it pops up again no matter what when the batch file is run.

I've tried many different switches in the batch files, but can't get it  to work 100%.  Here's my current batch file:

@echo off
net use i: \\xxxxxx001\gpsuite
start /min "C:\Program Files\Microsoft Online Services\Sign In\SignIn.exe"
gulfpakloans.lnk

The only other issues I'm having is that when running the script above, a new command window appears minimized on the taskbar (screenshot 1) and sometimes (on the client workstation) there's a balloon notification in the system tray saying that MS Sign-In is "Running in Minimized" or something similar.

One more note...  Only about 5 users will require this configuration.  If it was different, then I'd run it globally or have MS SignIn always on for all users, but can only have it running for a few.

I hope that this was easy enough to understand.  Please let me know what you suggest as I have to get this going today.

Thanks!


1.png
2.png
BzowKAsked:
Who is Participating?
 
oBdACommented:
The main error is that signin.exe is actually never started.
If quotes are required around the program path when using "start", the "title" parameter is required as well.
In other words, try

start "" /min "%ProgramFiles%\Microsoft Online Services\Sign In\SignIn.exe"

(Note the empty pair of quotes after "start"!)
To prevent signin.exe from starting if it's running already, you can check the tasklist:


@echo off
REM make sure I: is mapped to the correct drive:
if exist I: net use I: /delete
net use I: \\xxxxxx001\gpsuite
REM check if signin.exe is running already:
tasklist /FI "USERNAME eq %Username%" | find /i "signin.exe"
if errorlevel 1 (
  start "" /min "%ProgramFiles%\Microsoft Online Services\Sign In\SignIn.exe"
)
gulfpakloans.lnk

Open in new window

0
 
BzowKAuthor Commented:
Thank you very much for your suggestion.

One question, though - Since it's running on a XenApp server, many users use the same program at once.  In Task Manager when all users is checked, there may be up to about 5-10 signon.exe instances.  Does it check the complete task list or just the current users?  i'm assuming just the users bacause of the "USERNAME eq %Username%" line.

Should this prevent the extra empty command dialogue from opening too?

Thanks!
0
 
oBdACommented:
The tasklist command will only query the current user's session.
The empty command window was coming from the "start" command; simply try it: enter
start "calc.exe"
A command window with the title "calc.exe" will open, not the calculator.
Now enter
start "" "calc.exe"
and it will work.
0
 
BzowKAuthor Commented:
This batch script worked perfectly (...knock on wood :)...).  Thank you very much for taking the time to write it up and help.

Ben
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.