Use appcmd to set environment variable on all application pools

494 Views Asked by At

I've used appcmd to set environment variables on one application pool, but now I need to set it on all but 2 application pools, on some servers that have dozens of application pools running.

The idea was to set it in all and then remove it from the couple I need to remove it from instead of running the command 40 or 50 times to set it one by one.

Is it possible to do this ?

Thank you

1

There are 1 best solutions below

0
samwu On

You can try to this command:

appcmd.exe set config -section:system.applicationHost/applicationPools /+"environmentVariables.[name='foo',value='bar']" /commit:apphost

More infor you can refer to this link:

https://stackoverflow.com/a/44688613/13336642.