Is there an appcmd for setting Load User Profile to false on DefaultAppPool on IIS7 via appcmd?
I have already tried this
%systemroot%\system32\inetsrv\appcmd set config -section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false
But this only sets it for the defualt App Pool and doesnt change the main setting called "
Set Application pool defaults..."
You can do this with the following:
c:\windows\system32\inetsrv\appcmd.exe set config -section:applicationPools "/[name='appPoolNameGoesHere'].processModel.loadUserProfile:false"
c:\windows\system32\inetsrv\appcmd.exe set config -section:applicationPools "/[name='appPoolNameGoesHere'].processModel.loadUserProfile:true"
Related
I'm trying to run multiline command into the following script for urlrewrite https redirection under IIS through ansible playbook with the win_command but it shows error even i tried to put only the first command line into the win_command :
- name: configure https redirection urlrewrite
win_command: appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].match.url:"(client*)""
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsFile']"
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsDirectory']"
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.type:"Rewrite""
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.url:"client/index.html""
You need to add one command before these executed, otherwise appcmd will not find rule. I have tested it and succeeded
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS']"
How can I use appcmd in IIS10 to set the physical path of a website?
Something like...
appcmd set site summit /[path='/'].path:c:\newpath
This is the setting I am trying to change...
You could change the site physical path using below command:
appcmd set site /site.name:"site name" /application[path='/'].virtualDirectory[path='/'].physicalPath:"D:\newpath"
Do not forget to run the command prompt as administrator.
Given the following iis web.config
<sessionState customProvider="Foo" mode="Custom" timeout="90">
<providers>
<add name="FooProvider" type="Redis"/>
</providers>
</sessionState>
How would you change the values of <add name="FooProvider.. with appcmd?
I'm able to change the <sessionState customProvider>
appcmd.exe set config 'mycompany/mysite' -section:system.web/sessionState -customProvider:"bar" -timeout:90
But I don't know how to change <add name="FooProvider" to <add name="BarProvider"
I can delete the provider, and I can add a provider, however because I'm using CHEF to automate this, I need a way that is idempotent and can be run multiple times in a row.
Delete provider
appcmd set config 'mycompany/mysite' -section:system.web/sessionState /-"providers.[name='RedisSessionStateStoreProvider']
Create provider
appcmd set config 'mycompany/mysite' -section:system.web/sessionState /+"providers.[type='Redis',name='RedisSessionStateStoreProvider']"
Clear provider
appcmd clear config 'mycompany/mysite' -section:system.web/sessionState /providers
How can I modify the value of a provider without deleting and recreating it?
I don't believe this is possible, however I was able to work around it by using the fact that CHEF can do conditional "notify" of resources. I was able to preserve idempotence by only 'notifying' if the web.config file changes.
For reference, these are the commands that work.
Redis config
appcmd clear config 'MyCompany/mysite' '-section:system.web/sessionState'
appcmd.exe set config 'MyCompany/mysite' '-section:system.web/sessionState' '-mode:Custom' '-timeout:90' '-customProvider:RedisSessionStateStoreProvider'
appcmd set config 'MyCompany/mysite' '-section:system.web/sessionState' /+"providers.[name='RedisSessionStateStoreProvider',connectionString='10.10.10.10:6379,connectTimeout=5000,abortConnect=false,ssl=false',type='RedisAspNetProviders.SessionStateStoreProvider, RedisAspNetProviders']"
Sql config
appcmd clear config 'MyCompany/mysite' '-section:system.web/sessionState'
appcmd.exe set config 'MyCompany/mysite' '-section:system.web/sessionState' '-mode:SQLServer' '-allowCustomSqlDatabase:true' '-sqlConnectionString:network=dbmssocn; initial catalog=ASPState; user id=webfarmsession; connection lifetime=100;max pool size=200;data source=10.254.50.51; failover partner=10.254.50.50; password=xxxxxx' '-cookieless:false' '-timeout:90'
I've read a number of web articles explaining how to enabled Kerberos and NTML authentication. What is the process of removing these settings?
appcmd.exe set config "mysite" -section:system.webServer/security/authentication/windowsAuthentication /-"providers.[value='Negotiate']" /commit:apphost
appcmd.exe set config "mysite" -section:system.webServer/security/authentication/windowsAuthentication /-"providers.[value='NTLM']" /commit:apphost
Thanks!
Note here the -"providers... is to remove the settings, so if the above commands are executed, you would be first removing 'Negotiate' and then 'NTLM'
If you have additional other providers just add commands for the same and you would be able to remove the same.
Note: To add a new setting use +"providers... instead of -"providers... in the command.
I am running a site using Windows Azure Cloud. Is there a way I can ping my site every 20 minutes? My site has low traffic and I need to stop the site from starting and stopping the app pool all the time.
You might be able to setup a Cron Job to do a ping, check out Task 'Scheduling with Windows Azure Web Sites using a Cron Job Service' for an example
If you're using a full Cloud Service (a.k.a. Web Role) you can use a startup task to set the app pools to never shut down. This script does that, as well as a few other IIS configuration changes that I found useful.
#ECHO OFF
#REM A file to flag that this script has already run
#REM because if we run it twice, it errors out and prevents the Azure role from starting properly
#REM %~n0 expands to the name of the currently executing file, without the extension
SET FLAGFILE=c:\%~n0-flag.txt
IF EXIST "%FLAGFILE%" (
ECHO %FLAGFILE% exists, exiting startup script
exit /B
) ELSE (
date /t > %FLAGFILE%
)
#REM Enable IIS compression for application/json MIME type
#REM This will fail the second time you run it on a machine (eg, your desktop). So don't do that.
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json',enabled='True']" /commit:apphost
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
#REM Set IIS to automatically start AppPools
%windir%\system32\inetsrv\appcmd.exe set config -section:applicationPools -applicationPoolDefaults.startMode:AlwaysRunning /commit:apphost
#REM Set IIS to not shut down idle AppPools
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00 /commit:apphost
#REM remove IIS response headers
%windir%\system32\inetsrv\appcmd.exe set config /section:httpProtocol /-customHeaders.[name='X-Powered-By']