Configure application pools with the default settings using AppCmd.exe - iis-7

I am working on a build script and I need to reconfigure an application pool with the default settings hopefully using AppCmd.exe. Could you point me to the right direction? Thank you.

You can get a list of settings by using this...
appcmd list apppool "test" /text:*
You can check https://technet.microsoft.com/en-us/library/cc732992%28v=ws.10%29.aspx for more information.

Related

Set a default user/password when in localhost

Is there a way to set a default user/password in web.config of a ASP.NET application only while it's running in localhost?
I've done some research and found some tags like "credentials" but I ended up with no results.
Thanks :D
If you take advantage of the publish option and the web.release.config file, you can have the credentials in the root config, and write a transform to remote it from the web config when published in release mode.

IIS 7 Enabled Protocols

I have a win 2008r2 server. The default website has Enabled Protocols set to "http,net.tcp". When any new applications are created under the default website I would like then to default to having the same enabled protocols. Could anyone please advise how to do this? Currently when I Add Application one is created with an enabled protocol of only "http"
I found this was possible using the IIS provider for Powershell. The following line worked for me:
Set-ItemProperty IIS:\sites\$NetTcpWebsite -name EnabledProtocols -Value "http,net.Tcp"
In order to get the protocols to cascade from the website level down to the application level I had to do the following:
First I created the website and the applications.
Second I ran the following:
$iisAppName = %YourWebsiteName%
Set-ItemProperty IIS:\sites\$iisAppName -name applicationDefaults.enabledProtocols -Value "http,net.tcp"
That solved it for the original question. The answer from Rob will only set the Enabled Protocols profile at the website level which leaves your applications and virtual directories without the proper protocols enabled.
net and tcp protocols are used for WAS. They are disabled by default to minimize the surface for attacks.
Are you hosting WCF applications in order to need this?
http://technet.microsoft.com/en-us/library/cc735229(v=ws.10).aspx
Best regards.
I struggled with this for a while and looked at ways to include it in the MSI (WiX or other) or in the web.config file of each application or service. In the end the easiest solution was to change the Website default in IIS so that it applied to every application and service without needing to change the MSI or web.config. Basics steps are: In IIS Manager, click on the Sites node, then click "Set Website Defaults...", change the "Enabled Protocols" property to http,net.tcp

How to take backup in IIS

How do I take a backup of a site (and its settings) in IIS7 so that later if something goes wrong I can go back to my previous settings?
Updated:
I just want the settings, main website/sub- application, application pool etc. I can restore code from svn.
You can do the following:
%windir%\system32\inetsrv\appcmd.exe add backup "backup_name"
The above basically backs up %windir%\system32\inetsrv\config
You can also look into application config history: http://learn.iis.net/page.aspx/129/using-iis-70-configuration-history/
You probably want to start with (assuming a normal installation)
c:\windows\system32\inetsrv\config\applicationHost.config
as that's where the IIS config file is for websites.
There's not really the same "backup this site" like there was in IIS6, since they redid the underlying model.

Is it safe to delete the "InetPub" folder?

Does anyone know if deleting the InetPub folder will hurt IIS or anything related?
I am using IIS 7.
IIS will create it again AFAIK.
As long as you go into the IIS configuration and change the default location from %SystemDrive%\InetPub to %SystemDrive%\www for each of the services (web, ftp) there shouldn't be any problems. Of course, you can't protect against other applications that might install stuff into that directory by default, instead of checking the configuration.
My recommendation? Don't change it -- it's not that hard to live with, and it reduces the confusion level for the next person who has to administrate the machine.
If you reconfigure IIS7 to use your new location, then there's no problem. Just test that the new location is working, before deleting the old location.
Change IIS7 Inetpub path
Open %windir%\system32\inetsrv\config\applicationhost.config and search for
%SystemDrive%\inetpub\wwwroot
Change the path.
Don't delete the folder or you will create a registry problem. However, if you do not want to use IIS, search the web for turning it off. You might want to check out "www.blackviper.com" because he lists all Operating System "services" (Not "Computer Services" - both are in Administrator Tools) with extra information for what you can and cannot disable to change to manual. If I recall correctly, he had some IIS info and how to turn it off.
it is safe to delete the inetpub it is only a cache.

Rename virtual directory on Windows Server 2008 (IIS7 )

How can I rename a virtual directory (i.e., change the Virtual Path name) in IIS7 on Windows Server 2008?
In Server Manager I click on the application, select Basic Settings, but the box showing the current Alias is greyed out and I can't edit it.
I found a way to do this using the built in appcmd.exe tool. If you wanted to change your virtual directory "Images" inside your application "OldApplicationName" type this into the command line.
%systemroot%\system32\inetsrv\appcmd set vdir "Default Web Site/OldApplicationName/Images" -path:/Images2
More details, including how to rename applications here: http://www.foliotek.com/devblog/rename-applications-and-virtual-directories-in-iis7/
For as far as I know, there is no way to do it. You can only delete the virtual directory, and recreate it with the same settings.
Or at least, you can't do it through the GUI. There might be ways to do it through scripting in PowerShell for example. But I don't know how.
If you are also trying to rename the app, the context is almost the same except using "set app" instead of "set vdir"
appcmd set app "Default Web Site/OriginalSite" -path:/RenamedSite
You may want to checkout this post here
From adilei...
Try PowerShell, I think IIS7 has
introduced new administration tools
that look quite powerful. I think you
could also use these scripts to manage
IIS remotely via WMI.
It shouldn't be any more complicated
then VBScript.
Another way would be to use VBScript
to edit the IIS configuration files or
create an administration object, but
that doesn't really seem to be the way
to go about it.
and from jwmiller5...
Do you want to rename it in IIS, or
change the virtual path? adsutil can
do either. It should be installed in
c:\inetpub\AdminScripts
adsutil.vbs SET
W3SVC/svcnum/Root/AppName/AppFriendlyName
"New Friendly Name" adsutil.vbs SET
W3SVC/svcnum/Root/AppName/AppRoot "New
Application Path"

Resources