Copy Configuration Files to a Remote Server (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
IIS 7 uses XML files to specify Web server, site, and application configuration settings. The primary configuration file for IIS 7 is ApplicationHost.config. IIS 7 also uses Web.config files for applications or directories. These files can be copied from one Web server or site to another to apply the same settings to multiple objects.
This procedure can be performed at the following levels in IIS:
Physical and virtual directories
To perform this procedure, you must be a server administrator or you must have write access to the target location.
To copy and deploy a configuration file
You can perform this procedure by running xcopy commands in a command-line window.
Copy configuration to another location on the same computer
To locate help information about xcopy, type the following at the command prompt, and then press ENTER:
To copy configuration folders and files to another location on the same computer, use the following syntax:
xcopy sourcedestination /E
The variable source is the location from which you are copying the folders and files, and the variable destination is the location to which you are copying the folders and files. The parameter /E specifies that all the contents of the source location be copied to the destination location.
For example, to copy the IIS configuration folder and all its contents from the system root to another path on your local computer, type the following at the command prompt, and then press ENTER:
xcopy %windir%\system32\inetsrv\config c:\config /E
Copy configuration from one computer to another computer
To copy a source from your local computer to another computer, use the net use command to connect to the computer, and then use the xcopy command to copy the folder and files. To locate help about net use, type the following at the command prompt, and then press ENTER:
net use /?
For example, to copy the IIS configuration folder and all its contents from the system root to another computer, use the following syntax:
net use \\computername\drive * /USER:domain\username
The variable computername is the name of the computer to which you are connecting, and the variable drive is the drive to which you want to connect. The parameter * prompts you for a password to connect to the computer and drive after you run the command. The variable domain is the domain to which the user belongs, and the variable username is the user name of the user who is connecting to the computer.
Once you connect to the computer to which you want to copy files, you can use the xcopy syntax as specified in the previous section. For example, to connect to another computer and copy all the IIS configuration folders and files from the system root on your local computer to the other computer, type each of the following commands at the command prompt, and then press ENTER:
net use \\contoso\c$ * /USER:SALES\joseph
xcopy %windir%\system32\inetsrv\config \\contoso\c$\config /E
After you are finished copying folders and files to the remote computer, you should close the connection. To do this type the following at the command prompt, and then press ENTER:
net use \\contoso\c$ /delete