InfotechGuyz.com Blog

Installing IIS 7.0 on Server 2008 from command line / Script

You can install IIS from command line on Server 2008 using pkgmgr.exe.

Start /w pkgmgr.exe /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI

IIS 7.0 Configuration Files Explained

IIS 7.0 use configuration files instead of
the IIS metabase. IIS 7.0 configuration consist of four files.

1. Machine.config – These settings apply globally.
2. ApplicationHost.config – These settings are specific to IIS. Found in %systemroot%\system32\inetsrv
3. Web.config, root-level – These settings are shared by .NET applications. Found in %systemroot%\ Microsoft.NET\Framework\versionNumber\CONFIG.
4. Web.config, application-level – These settings apply to a specific .NET application.

 

Managing IIS 7.0 from command line on Server 2008

You can use %WINDIR%\system32\inetsrv\APPCMD.EXE to manage IIS 7.0 from command line in Server 2008.

Examples:
List all sites and its details
Appcmd.exe list SITE

List Default Web Site
APPCMD.EXE list SITE "Default Web Site"

List started sites
APPCMD.EXE list SITE /state:started

List all start / stopped application pools
APPCMD.EXE list apppools /state:started
APPCMD.EXE list apppools /state:stopped

Add a site called MySite on Port 80 in c:\inetpub\MySite
APPCMD.EXE add site /name:"MySite" /id:123 /bindings:"http:/*:80:"
/physicalPath:"C:\inetpub\MySite"

List real time HTTP requestes
APPCMD.EXE list requests

List IIS configuration
APPCMD.EXE list config

Backup IIS configuration
APPCMD.EXE add backup IISBACKUP

Restore IIS configuration
APPCMD.EXE restore backup IISBACKUP

 

 

 

 

written by InfoTechGuyz