Udostępnij za pośrednictwem


Copying IIS Configurations Using Iiscnfg.vbs

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

You can use the command-line script iiscnfg.vbs, which is stored in systemroot\System32, to copy the IIS metabase and schema from one computer to another. Both computers must be running a member of the Windows Server 2003 family with IIS 6.0.

By default, iiscnfg.vbs copies the metabase of the local computer to the target computer that is specified by the /ts parameter. However, you can use the /s parameter to copy the metabase of another computer to the target computer.

Important

You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /User:MyComputer\Administrator cmd to open a command window with administrator rights and then type cscript.exe ScriptName (include the script's full path and any parameters).

This topic includes the following information:

  • Overview: Key concepts in understanding the copy procedures.

  • Syntax: The order in which you type a command and any arguments and options that follow it.

  • Parameters: The values that are given to variables in the command.

  • Examples: Sample code and an explanation of the results.

Overview

The /copy operation uses iisback.vbs to make a backup copy of the source metabase and the schema. Afterward, it copies the backup copy files (.MDx and .SCx) to the target computer and uses iisback.vbs to replace the metabase and schema of the target computer with the backup copy.

Although you can do these operations manually, /copy provides a convenient one-step method to replicate an IIS configuration. The /copy operation replaces the features of iissync.exe, a tool formerly included in Windows.

The /copy operation does not copy the server content, such as Web pages and FTP files, that is associated with the IIS configuration. Instead, /copy changes the computer-specific and system-specific properties in the metabase so that they are valid on the target computer. However, it does not adjust the directory or file paths. As a result, paths in the configuration might not be valid on the target computer.

Syntax

iiscnfg /copy /ts TargetComputer /tu TargetUser**/tp** TargetPassword [/s Computer [/u [Domain\]User [/p Password]]]

Parameters

/tsTargetComputer

Required. Copies the IIS metabase to the specified computer. Type the IP address or computer name without backslashes.

/tuTargetUser

Required (even when the current user of the local computer is an administrator of the target computer). Specifies the account used to connect to the target computer. Type a user account in [Domain]\User format. This account must be a member of the Administrators group on the target computer.

/tpTargetPassword

Required. Specifies the password for the account that is specified by the /tu parameter.

/sComputer

Copies the IIS metabase of the specified remote computer to the target computer. This parameter runs the script on the remote computer. Type the name or IP address of a remote computer without backslashes. The default is the local computer.

/u*[Domain\]User*

Required only when the current user is not an administrator of the remote computer. Runs the script with the permissions of the specified user account. The default is the current user of the local computer.

/pPassword

Specifies the password of the user account that is specified in the /u parameter. If you omit this parameter, the script prompts you for the password and obscures the text you type.

Examples

Example 1:

The following example copies the IIS configuration of the local computer to the Svr01 server. The command uses the /ts parameter to identify the target server, and the /tu and /tp parameters to provide the user's administrator account and password on the Svr01 server.

iiscnfg /copy /ts SVR01 /tu SVR01\Admin06 /tp P@ssWord6

In response, iiscnfg displays a list of the steps it takes to copy the IIS configuration.

Microsoft (R) Windows Script Host Version 5.6

Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Backing up server 127.0.0.1

cmd /c iisback /backup /b iisreplback /overwrite

Backup complete.

Mapping local drive D: to admin share on server 127.0.0.1

Mapping local drive E: to admin share on server Svr01

Copying backup files...

cmd /c copy /Y D:\System32\inetsrv\metaback\iisreplback.* E:\System32\inetsrv\metaback

Unmapping local drive D:

Restoring on server Svr01

cmd /c iisback /restore /s svr01 /u SVR01\Admin06 /p P@ssWord6 /b iisreplback

Restore complete.

Unmapping local drive E:

This display shows that iiscnfg issues commands to Backing Up IIS Configurations Using Iisback.vbs, first to create a backup copy of the metabase and schema and then to restore (or paste) it to the target computer. To do so, it must copy the backup copy files (iisreplback.*) to the target computer.

The IP address, 127.0.0.1, is the loopback address and refers generically to the local computer. This address is used only when copying the configuration of the local computer.

Example 2:

The following example copies the IIS configuration of a remote computer, Svr06, to the MainBkp server. The command uses the /s parameter to identify the remote computer and the /u parameter to provide the user's administrator password on the Svr06 computer. It also uses the /ts parameter to identify the target server, and the /tu and /tp parameters to provide the user's administrator account and password on the MainBkp server.

Please note that although the /p parameter is optional, the /tp parameter is required. If you omit it, the command fails.

iiscnfg /copy /s Svr06 /u Domain01\Admin01 /ts MainBkp /tu MainBkp\Admin01 /tp P@ssWord6

In response, iiscnfg prompts you for the password for the account specified by the /u parameter, which specifies the permissions under which the script runs, and then it displays a list of the steps it takes to copy the IIS configuration. The phrase "Restore complete" indicates that the /copy operation was successful.

Microsoft (R) Windows Script Host Version 5.6

Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Enter the Password:

Processing...

Backing up server Svr06

cmd /c iisback /backup /s Svr06 /u Domain01\Administrator /p B##jdt! /b iisreplback /overwrite

Backup complete.

Mapping local drive G: to admin share on server Svr06

Mapping local drive I: to admin share on server MainBkp

Copying backup files...

cmd /c copy /Y G:\System32\inetsrv\metaback\iisreplback.* I:\System32\inetsrv\metaback

Unmapping local drive G:

Restoring on server MainBkp

cmd /c iisback /restore /s MainBkp /u MainBkp\Admin01 /p P@ssWord6 /b iisreplback

Restore complete.

Unmapping local drive I: