Deleting Web Sites
You can use the command-line script iisweb.vbs, stored in the systemroot\System32\ directory, to delete IIS Web site configurations on local or remote Windows.NET servers running IIS.
This command can be useful if you plan to move the site to a new URL or server, or remove it entirely. The content within the site is unaffected by this command, but the site will be inaccessible to users.
Important You must be a member of the Administrators group on the local computer to run scripts and executables, or you must have been delegated the appropriate authority. As a security best practice, log on to your computer 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. From the command prompt, type runas /user:administrative_accountname "script or executable command".
This topic includes the following sections:
- Syntax: The order in which you type a command and any arguments and options that follow it.
- Parameters: The values given to variables in the command.
- Examples: Sample code and an explanation of the results.
Syntax
iisweb /deleteWebSite [WebSite...] [/scomputer [/u [domain\]user**/p**password]]
Parameters
WebSite
Specifies the site name or metabase path of the Web site. This parameter is required.Web sites must be uniquely identified. If more than one Web site has the same descriptive name, you must use the metabase path to identify the Web site.
/scomputer
Specifies the name or IP address of a remote computer (with no backslashes). The default is the local computer./u [domain\]user
Runs the script with the permissions of the specified user account. The default is the permissions of the user logged on to the computer running the script./ppassword
Specifies the password of the user account specified in the /u parameter.
Example 1
The following example deletes a single Web site configuration on a local computer. The /s parameter is omitted because the local computer is the default setting. The /u and /p parameters are omitted because the current user of the local computer must be logged on as an administrator to run the command.
iisweb /delete "My First Novel"
Iisweb.vbs displays a message indicating the site configuration has been deleted, identifing the Web site by its metabase path.
Connecting to server ...Done. Server W3SVC/409413479 has been DELETED.
Example 2
The following example deletes multiple Web site configurations from a remote computer. The Finance, Work Group, and Logo Web sites reside on Svr01. The command identifies the first two sites by name and the Logo Web site by its metabase path, W3SVC/79116006. The command uses the /s parameter to specify the remote computer and the /u and /p parameters to run the commands with the permissions of the user's Administrator account.
iisweb /delete Finance "Work Group" W3SVC/79116006 /s Svr01 /u Alice /p p@##word
Iisweb.vbs displays a message indicating the site configurations have been deleted, identifing each Web site by its metabase path.
Connecting to server ...Done. Server W3SVC/1977437537 has been DELETED. Server W3SVC/1509060625 has been DELETED. Server W3SVC/79116006 has been DELETED.
Related Topics
- For information on creating Web site configurations, see Creating Web Sites .
- For information on listing Web site configurations, see Listing Web Sites .
- For information on starting Web sites, see Starting Web Sites.
- For information on stopping Web sites, see Stopping Web Sites.
- For information on pausing Web sites, see Pausing Web Sites.