Bobcares

How to Export IIS configuration with AppCmd

by | Feb 17, 2024

Learn how to export IIS configuration with AppCmd. Our IIS Support team is here to help you with your questions and concerns.

How to Export IIS configuration with AppCmd

Managing multiple IIS servers in a Load Balanced Environment can be difficult as it involves duplicating website configurations on each server.

Fortunately, we can make this easier by exporting configurations from one server and importing them onto others.

How to Export IIS configuration with AppCmd

Furthermore, in IIS 7 or 7.5, creating a website automatically generates a unique application pool for that site.
Importantly, when transferring configurations to a second server, we have to import the associated application pools first. This supports the proper functioning of websites, as they rely on application pools, as well as a systematic import process to maintain consistency.

  1. How to Export the Application Pools on IIS 7
  2. How to import the Application Pools
  3. How to Export All of Our Websites
  4. How to Export a Package through IIS Manager
  5. Streamlining Application Pool Migration in IIS:

How to Export the Application Pools on IIS 7

We can export application pools on IIS 7 with the following command:

%windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\apppools.xml

This command generates an XML file (apppools.xml) that contains all application pools on the webserver. Then, we need to edit this file to exclude unnecessary applications like DefaultAppPool, Classic .NET AppPool, and SecurityTokenServiceApplicationPool.

We have to remove apppools that already exist on the second webserver, as the appcmd command does not skip existing ones. Instead, it terminates without importing any. This editing process results in a refined selection of application pools and prevents redundancy.

How to import the Application Pools

We can import the Application Pools with this command:

%windir%\system32\inetsrv\appcmd add apppool /in < c:\apppools.xml

This command will create all the AppPools in the xml on the second webserver.

How to Export All of Our Websites

We can easily export our entire website with this command:

%windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml

This command exports all the websites on our webserver. So we have to edit the sites.xml and remove the websites that we do not need to import.

We can also export a single website or application pool by adding the name of the Application Pool or Website to the command line:

 %windir%\system32\inetsrv\appcmd list site “MyWebsite” /config /xml > c:\mywebsite.xml

Or

%windir%\system32\inetsrv\appcmd list apppool “MyAppPool” /config /xml > c:\myapppool.xml

How to Export a Package through IIS Manager

Before we begin, make sure you have NET Framework 2.0 SP1 or greater, Web Deployment Tool and IIS 7.0 or above, or IIS Remote Manager.

  1. To begin with, make a backup with the following command:

    %windir%\system32\inetsrv\appcmd add backup "PreMsDeploy"

  2. Then, open the IIS Manager by entering inetmgr in the Run dialog box.
  3. Next, expand the Server node and the Sites node in the IIS Manager. Then select the Default Web Site/MyApplication option.
  4. Now, go to the right-hand Actions pane under Manage Packages. Then, click the “Export Application… “ option to start the wizard.
  5. Furthermore, the package contains the site or application we have selected and its content folders. So, we have to click the Manage Components button.
  6. Now, the first row is the iisapp provider entry. This is our application. We have to select the dbFullSql provider from the Provider Name drop-down in the second row. We can see a description and example path by hovering over a provider.
  7. Then, enter the path to the database or script file in the Path column. For example:

    Data Source=.\SQLExpress;Database=MyApplicationDb;User id=MyAppUser;Password=NewPassword;

    Now, we will see the database in the package contents tree view. Click Next to proceed.

  8. At this point, we will be able to see parameters generated as per the providers that we added in the previous step. We can names and descriptions.
  9. Now, choose the second parameter in the list, Parameter 2, and click the Add Parameter Entry button.
  10. In this example, we are creating a parameter entry that points to the connection string within the application’s Web.config file. So the parameter entry has 3 fields to be filled.
  11. We can select the type of parameter you want. Here, we will be selecting XmlFile as we want to point to the Web.config file.
  12. Then, enter the scope for the parameter entry.
  13. After that, we have to add a match.
  14. At this point, we have parameters that lets a user install this package to set the application path and change the connection string. So, click Next to continue.
  15. Finally, select a location to save the package.
  16. The wizard will handle the packaging process and then save the package to disk. After that, we can see a Summary page with an overview of all actions.

Streamlining Application Pool Migration in IIS:

Migrating multiple application pools in IIS can be difficult without the right guide. So, follow these step-by-step instructions to export and import application pools easily.

  1. To begin with, open an elevated command prompt and run this command:

    %windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\apppools.xml

    This will generate an XML file with information about our application pools.

  2. Next, export the configuration of the default website as seen here:

    %windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml

    This command creates an XML file that captures the configuration of the default website.

  3. Then, move the generated XML files to the target server. Remember to edit the site value in the sites.xml file from 1 to 2 to avoid conflicts.
  4. Next, remove existing app pools and run these commands to import the exported configurations on the target server:

    %windir%\system32\inetsrv\appcmd add apppool /in < c:\apppools.xml
    %windir%\system32\inetsrv\appcmd add site /in < c:\sites.xml

  5. We can avoid conflicts by removing the original default website and renaming the newly imported site to “Default Web Site” or another name.
  6. Then, open bindings and bind the old certificate to the new site to ensure a secure connection.
  7. Finally, carry out a check on the realms and their updated app pools. Also, review app pool permissions, especially if domain accounts are involved. We can complete the process with an IIS restart.

With the above steps, we can streamline the migration of multiple application pools in IIS, resulting in a hassle-free transfer and minimizing potential conflicts.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to export IIS configuration with AppCmd.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF