Script to stop launch if condition mot met
First thanks to anyone who helped me in the past.. I gleen most of my info from this site... but occasionally I find I do need help....
I've been doing some App-v work and whilst I have got to grips with the basics and been able to add a few scripts I have a bit of a problem..
Is it possible to have ascript that can be added to an existing OSD to check if say a particular application or version is installed (I can get the info and do an if then else) but if the condition is met simply continue unhindered and launch the app, but if it is not met put a Message box to the user (it will do a few other things) and stop the app launching and exit.
I know I could simply wrap the app within the sequence so say a VBscript is called that makes the decision and either continues to execute or bypasses the exe and displays a message etc so in effect the app will still be executed as teh VBS will be the app but I have a lot to do (possibly a few 100) and thought a Pre Launch script could be debveloped and tested and simply inserted quicker..
I've been doing some App-v work and whilst I have got to grips with the basics and been able to add a few scripts I have a bit of a problem..
Is it possible to have ascript that can be added to an existing OSD to check if say a particular application or version is installed (I can get the info and do an if then else) but if the condition is met simply continue unhindered and launch the app, but if it is not met put a Message box to the user (it will do a few other things) and stop the app launching and exit.
I know I could simply wrap the app within the sequence so say a VBscript is called that makes the decision and either continues to execute or bypasses the exe and displays a message etc so in effect the app will still be executed as teh VBS will be the app but I have a lot to do (possibly a few 100) and thought a Pre Launch script could be debveloped and tested and simply inserted quicker..
0 Comments
[ + ] Show comments
Answers (5)
Please log in to answer
Posted by:
anonymous_9363
13 years ago
Build a generic script which looks up values in, say, an INI or XML file. You can then have a 3rd party populate the INI/XML. Your script will have to do sanity-checking of all values entered. Good coding practice will cater for most errors anyway.
You could have either a single master config file for all the apps or one per app.
You could have either a single master config file for all the apps or one per app.
Posted by:
Dogsbody
13 years ago
Hi My problem is not the actual script.. I can get a script outside of APP-v to do what I want...
but I need to put a srcipt into an existing OSD file to perform the check and abort if needed
I need to stop an APP-v Sequence from loading and running if my conditions are not met
start script (Pre Stream or Load)
is the app being run on "workstation build xyz"
Yes - continue (thus drop out of the script and continue with Stream Load Run
No - display message to user when they press "ok"
Do not continue with the stream load run but abort the App-v app and close window
I can't see how I can abort the App-v load/run process
If I execute a Pre script once it has finished the app will continue to load and run... I need to stop this..
but I need to put a srcipt into an existing OSD file to perform the check and abort if needed
I need to stop an APP-v Sequence from loading and running if my conditions are not met
start script (Pre Stream or Load)
is the app being run on "workstation build xyz"
Yes - continue (thus drop out of the script and continue with Stream Load Run
No - display message to user when they press "ok"
Do not continue with the stream load run but abort the App-v app and close window
I can't see how I can abort the App-v load/run process
If I execute a Pre script once it has finished the app will continue to load and run... I need to stop this..
Posted by:
pjgeutjens
13 years ago
Pete,
you might want to look into the ABORTRESULT and SUCCESSRESULT options for the SCRIPT tag in your OSD.
As for more info on this, only one place I can send you to and that's http://www.tmurgent.com/OSD_Illustrated.aspx (That's where I found this [:D])
Rgds,
PJ
you might want to look into the ABORTRESULT and SUCCESSRESULT options for the SCRIPT tag in your OSD.
As for more info on this, only one place I can send you to and that's http://www.tmurgent.com/OSD_Illustrated.aspx (That's where I found this [:D])
Rgds,
PJ
Posted by:
Dogsbody
13 years ago
Posted by:
Dogsbody
13 years ago
Ok.. many thanks again for pointing me in the right direction on this....
Everything works as I want..
A few things I found...
Firstly if you trap the error in your script with say an "if then else" then it will always exit with an exit code of '0'
so pop a wscript.quit(1) in so you can set you Sucess or Abort results accordingly.
However as the script exits, the App-v client catches this error and whilst the app does not load etc App-v will pop an error message on the screen telling that the script exited with an error code. The last bit of the code is the Exit code you quit the script with...
I guess that can be useful if you have several scenarios and if you design your exits to give a code indicating what is not met then the error will tell the helpdesk why the script exited if a call is logged.
cheers.
Everything works as I want..
A few things I found...
Firstly if you trap the error in your script with say an "if then else" then it will always exit with an exit code of '0'
so pop a wscript.quit(1) in so you can set you Sucess or Abort results accordingly.
However as the script exits, the App-v client catches this error and whilst the app does not load etc App-v will pop an error message on the screen telling that the script exited with an error code. The last bit of the code is the Exit code you quit the script with...
I guess that can be useful if you have several scenarios and if you design your exits to give a code indicating what is not met then the error will tell the helpdesk why the script exited if a call is logged.
cheers.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.