1

I am using the following appcmd to add an autoStartProvider to the list of autoStartProviders:

appcmd.exe set config -section:system.applicationHost/serviceAutoStartProviders /+"[name='MyAutoStartup',type='PreWarmCache, MyAssembly, version=1.0.0.0, Culture=neutral, PublicKeyToken=null']" /commit:apphost

Running the script for the first time, everything works correctly. But when running the script for the second time it complains that "MyAutoStartup" already exists. I know I can clear out the collection by using:

appcmd.exe clear config -section:system.applicationHost/serviceAutoStartProviders -commit:apphost

but that would remove all keys, not just MyAutoStart.

Is there a way to only remove MyAutoStart if it is present?

2

After experimenting I found the following command worked:

appcmd.exe set config -section:system.applicationHost/serviceAutoStartProviders /-"[name='MyAutoStartup',type='PreWarmCache, MyAssembly, version=1.0.0.0, Culture=neutral, PublicKeyToken=null']" /commit:apphost

Basically it is replacing the "/+" with a "/-"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.