Hi robm. I've not worked extensively with the undeploy and redeploy commands, but I know a little about the middle tier deployment that may help you understand the doc a bit better. First in the doc you reference if you go to the topic Scripting Tool for SAS Web Application Server you will see that it references a file called appserver.properties and that this file, which is located on your master under Lev<n>/Web/Scripts/AppServer/props, is referenced when you run the commands you mention. In here you will find the names of all the applications you have deployed in the environment and the name of the application server instance that was configured to manage an application. For example on one of my systems in this file I have the following entries:
application.15.name=SASThemes9.4
application.15.serverName=SASServer1
...
application.20.name=SASVisualAnalyticsServices6.3
application.20.serverName=SASServer12
These properties tell me that SASThemes9.4 is the "application-name" of the application I want to undeploy and that SASServer1 is the "server". If I wanted to undeploy only this application the command syntax would look like:
appsrvconfig.cmd -e run undeploy application SASThemes9.4 server SASServer1 <- This is for Windows. Use appsrvconfig.sh for Unix.
If I wanted to undeploy everything that is managed under SASServer1 I could specify "all" for the application-name instead:
appsrvconfig.cmd -e run undeploy application all server SASServer1
For SASVisualAnalyticsServices6.3 I would use:
appsrvconfig.cmd -e run undeploy application SASVisualAnalyticsServices6.3 server SASServer12
And for everything under SASServer12 I would use:
appsrvconfig.cmd -e run undeploy application all server SASServer12
So once you have the syntax down the easiest way to retrieve specific applications names for apps that are defined in your environment would be too look for the application.<xy>.name in the properties file. Then you could use the technique described in the Executing a Batch Script section to capture all these commands in a script so you don't have to run them individually on each horizontal cluster.