Ways to delete a Web site using iisweb.vbs (support for bulk deletion) _vbs

Source: Internet
Author: User
Tags metabase

Applied to: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1
You can use command-line scripting iisweb.vbs (stored in systemroot\system32) to remove the IIS Web site configuration on a local or remote computer running a member of the Windows Server 2003 family with IIS 6.0.
This command is useful if you plan to move the site to a new URL or server, or if you want to completely remove the site. Site content is not affected by this command, but users will not be able to access the site.

Important Important matters

Only members of the Administrators group on the local computer can run scripts and executables. As a security best practice, log on to the computer using an account that is not part of the Administrators group, and then use the runas command to run scripts and executables as an administrator. At the command prompt, type runas/profile/user:mycomputer\administrator cmd, open a command window with administrator privileges, and then type Cscript.exescriptname (including the full path and any parameters of the script).
This topic includes the following information:
Syntax: The order in which you type the command and any parameters and options that follow it.

Parameter: gives the value of the variable in the command.

Example: Sample code and a description of the result.

Grammar
Iisweb/delete WebSite [WebSite ...] [/S Computer [/u[domain\]user/p Password]]
Parameters
WebSite
Required. Specify a site name or metabase path for the Web site. 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.
/s Computer
Runs the script on the specified remote computer. Type the name or IP address of the computer without the backslash. By default, the script runs on the local computer.
/u [domain\]user
Runs the script with the permissions of the specified user account. The account must be a member of the Administrators group on the remote computer. By default, the script runs with the permissions of the current user of the local computer.
/P Password
Specifies the password for the user account specified in the/u parameter.

Example

Example 1:
The following example deletes a single Web site configuration on the local computer. The/s parameter is ignored because the local computer is the default setting. The/U and/p parameters are ignored because the current user of the local computer must be logged on as an administrator to run the command.

Copy Code code as follows:

Iisweb/delete "My I-novel"

In response, IIsWeb displays the following message indicating that the site configuration has been deleted and that the site is identified 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" sites are located in SRV01. This command identifies the first two sites by name and identifies the logo site by its metabase path "w3svc/79116006". In addition, the command uses the/s parameter to specify the remote computer, and the/U and/P parameters run the command with the user's administrator account permissions.

Copy Code code as follows:

Iisweb/delete Finance "Work Group" w3svc/79116006/s srv01/u alice/p p@# #word

In response, IIsWeb displays the following message indicating that the site configuration has been deleted and that each site is identified 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.

The cloud-dwelling community complements the bulk deletion method:

Copy Code code as follows:

Iisweb/delete "My I-novel"
Iisweb/delete "My I-Nove2"
Iisweb/delete "My I-Nove3"

Save the above code as a bat.

You can also schedule tasks to be executed on a regular basis.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.