Вы находитесь на странице: 1из 14

Using IIS Command-Line Utilities to Manage IIS

The Types of Commands used to Manage IIS from the Command Line
The types of commands that manage IIS from the command line are:

IISReset, Windows Management Instrumentation (WMI) scripts, Active Directory Services Interface (ADSI),
and the standard Windows commands and Support Tools utilities.

IISReset Command-line Utility


IISReset is a command-line utility that has been in existence from IIS 5 that can be used to stop IIS, restart IIS, and
reboot the IIS server. Typical reasons for restarting IIS are:

When problematic ASP.NET and ASP applications exist and resource leaks need to be eliminated, or to
initiate resource recycling.

When certain IIS configuration changes are made, users need to restart IIS so that the changes are applied. A
few of these types of configuration settings changes are listed below:

o IIS needs to be restarted when the IIS isolation mode is changed.

o When a metabase from a metabase history file is restored manually, restart IIS.

o Restart IIS when the Direct Metabase Edit features property is changed, EnableEditWhileRunning,
directly in the metabase file.

o IIS also has to be restarted whenever changes are


made to any global configuration settings located
under
HKLMSoftwareMicrosoftInetMgrParameters.

Windows Management Instrumentation


(WMI)
Use WMI scripts for a few typical IIS management tasks:

Create and delete websites and FTP sites

Create and delete virtual directories

Enable/disable web service extensions

Backup and restore IIS configuration and copy IIS configuration

Import/export portions of the metabase as well as other management tasks


Microsoft provides a few WMI scripts and they are located in the WindowsSystem32 directory. These WMI scripts
and their associated functions are listed below:

iisweb.vbs: Performs the following management tasks from the command line:

o List Web sites

o Create/delete Web sites

o Start/stop Web sites

iisvdir.vbs: Performs the following management tasks from the command line:

o Create/delete virtual directories for Web sites.

o List virtual directories in a specified root.

iisapp.vbs: Lists all Web applications running on the IIS machine.

iisback.vbs: Backs up and restores IIS configuration settings and deletes IIS backups.

iiscnfg.vbs: Performs the following management tasks from the command line:

o Import and export IIS configurations as XML files.

o Save IIS configuration to disk.

o Copy IIS configuration settings.

iisext.vbs: Performs the following management tasks from the command line:

o List applications

o Enable applications

o Add/remove application dependencies

o Enable/disable web service extensions

o List and add/remove web service extension files

o Enable/disable web service extension files

iisftp.vbs: Performs the following management tasks from the command line:

o List FTP sites

o Create/delete FTP sites

o Start/stop FTP sites

o Set Active Directory user isolation for your FTP sites

iisftpdr.vbs: Performs the following management tasks from the command line:

o Create and delete virtual directories in FTP sites.


o List virtual directories in a specified root.

Active Directory Services Interface (ADSI)


Active Directory Services Interface (ADSI) was used in II 5 to manage IIS from the command line. Through ADSI,
users can change IIS configuration settings and configure websites, applications, and virtual directories from the
command line. With IIS 6, it is recommended to use WMI scripts over ADSI. Any custom ADSI scripts previously
used in IIS 5 should be tested to verify that they work in IIS 6.

Windows Commands and Support Tools Utilities


A few IIS specific Windows commands, such as the net commands, can be used to manage IIS from the command
line:

net start and net stop: Used to start and stop IIS services. The service name that should be used when utilizing
the net command to start or stop IIS services are listed below:

o FTP service = msftpsvc

o IIS Admin service = iisadmin

o NNTP service = nntpsvc

o SMTP service = smtpsvc

o WWW service = w3svc

net localgroup: adds a user account to the IIS_WPG group. Accounts utilized as application pool identities are
members of the IIS_WPG group.

Cacls: Captures NTFS permissions on the IIS server.

Convlog: Converts the IIS log files to the NCSA format.

Users can also use the resource kit utilities listed below to manage certain elements of IIS:

secedit: Used to administer security templates.

auditpol: Used to change audit policies from the command line.

showmbrs: Used to list the members of security groups which have permissions on directories and files.

How to Schedule IISReset.exe through Task Scheduler


IISReset is typically helps users to recover from faulty application situations. Users can use Windows Task Scheduler
to schedule IIS to restart according to predefined parameters.

1. Open Control Panel.

2. Select Scheduled Tasks then select Add Scheduled Task.

3. Click Next for the Scheduled Task Wizard to start.

4. Click Browse and browse to WindowsSystem32 folder.


5. Double click IISReset.exe.

6. Enter a task name and select when the task should run. Click Next.

7. Enter the Administrator account details that should be utilized to run IISReset. Click Next.

8. To configure advanced task scheduling properties, click the Advanced checkbox or click Finish.

9. Open the Properties dialog box of the task just configured and click the Task tab.

10. Add any additional switches in the Run box.

11. Click OK.

How to Use iisweb.vbs to Manage Web sites


The iisweb.vbs utility is used to list Web sites, create and delete Web sites, and start and stop Web sites in IIS.

iisweb.vbs has the following main switches:

/create, for creating a Web site.

/delete, for deleting a Web site.

/start, for starting a Web site.

/stop, for stopping a Web site.

/pause, for pausing a Web site.

/query, for troubleshooting a Web site displaying all the Web sites on the IIS machine.

To create a Web site, use:

iisweb[.vbs] /create Path SiteName [/b Port] [/i IPAddress] [/d HostHeader] [/dontstart] [/s
Computer [/u [Domain]User [/p Password]]]

Path the physical location to the files for the Web site. When the directory does not exist, the script creates
it.

SiteName the name of the new Web site. This is the name that will be displayed in IIS Manager.

/b Port the port on which the new Web site should listen for HTTP requests. The default value is port 80.

/i IPAddress the IP address that must be assigned to the Web site.

/d HostHeader the host header for the new site.

/dontstart used to indicate that IIS should not automatically start the Web site after it is created. IIS by
default starts a newly created Web site.

/s Computer used to indicate that the script should run on this remote computer. The local computer is used
by default.

/u [Domain]User the account credentials that must be used to create the website on the remote computer.
/p Password the password of the account credentials (above).

To start, stop, delete, or pause a Web site, use:

iisweb[.vbs] {/delete | /start | /stop | /pause} WebSite [WebSite...] [/s Computer [/u
[Domain]User [/p Password]]]

WebSite the name of the website that should be deleted, started, stopped, or paused.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to delete, start, stop, or pause the website on
the remote computer.

/p Password - the password of the account credentials (above).

To query websites on IIS servers, use

iisweb[.vbs] /query [WebSite [WebSite...]] [/s Computer [/u [Domain]User [/p Password]]]

How to Use iisvdir.vbs to Manage Virtual Directories


The iisvdir.vbs command can be used to list virtual directories in a specified root to create and delete virtual
directories for websites and to query virtual IIS server directories.

To create a virtual directory for a website, use:

iisvdir /create WebSite[/VirtualPath] Name PhysicalPath [/s Computer [/u [Domain]User /p


Password]]

WebSite the name of the website that the virtual directory will be created for.

VirtualPath the virtual path under which this virtual directory should be created (optional).

Name the name of the new virtual directory.

PhysicalPath the name of physical directory where the virtual directory points.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User- the account credentials that must be used to create the virtual directory for the remote
computer.

/p Password the password of the account credentials (above).

To delete a virtual directory associated with a Web site, use:

iisvdir /delete WebSite[/VirtualPath] Name [/s Computer [/u [Domain]User/p Password]]

WebSite the name of the Web site that is associated with the virtual directory to be deleted.

VirtualPath the virtual path that holds the virtual directory (optional).

Name the name of the virtual directory to be deleted.


/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to delete the virtual directory.

/p Password the password of the account credentials (above).

To query website specific virtual directories on IIS servers, use

iisvdir /query WebSite[/VirtualPath][/s Computer [/u [Domain] User/p Password]]

WebSite the name of the website that is associated with the virtual directory to be queried.

VirtualPath the virtual path that holds the virtual directory (optional).

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to query for virtual directories.

/p Password the password of the account credentials (above).

How to Use iisftp.vbs to Manage FTP Sites


The iisftp.vbs utility performs management tasks from the command line that are specific to managing FTP sites on
the IIS servers.

iisftp.vbs has the following main switches:

/create, for creating a FTP site.

/delete, for deleting a FTP site.

/start, for starting a FTP site.

/stop, for stopping a FTP site

/query, for troubleshooting a FTP site displaying all the FTP sites on the IIS machine.

/setadprop, for indicating that Active Directory properties should be used for a particular user accessing the
FTP site.

/getadprop, for obtaining Active Directory properties for the particular user.

To create an FTP site, use:

iisftp /create Path SiteName [/b Port] [/i IPAddress] [/dontstart] [/isolation {AD|Local}
[/domain DomainName /Admin [Domain]User /AdminPwd Password]] [/s Computer [/u [Domain]User/p
Password]]

Path, the physical location to the files for the FTP site.

SiteName, the name of the new FTP site. This is the name that will be displayed in IIS Manager.

/b Port, the port on which the new FTP site should listen for FTP requests. The default value is port 21.
/i IPAddress, the IP address that must be assigned to the FTP site.

/dontstart, used to indicate that IIS should not automatically start the FTP site after it is created. IIS by
default starts all newly created sites.

/isolation, used to indicate the isolation mode that should be used.

domain, when Active Directory is selected as the isolation mode, this is the domain for Active Directory.

admin, when Active Directory is selected as the isolation mode, this is the admin account credentials for
Active Directory.

AdminPwd, when Active Directory is selected as the isolation mode, this is the password of the admin account
for Active Directory (above).

/s Computer, used to indicate that the script should run on this remote computer. The local computer is used
by default.

/u [Domain]User, the account credentials that must be used to create the FTP site on the remote computer.

/p Password, the password of the account credentials (above).

To start, stop, delete, or pause an FTP site, use:

iisftp[.vbs] {/delete | /start | /stop | /pause} FTPSite [FTPSite...] [/s Computer [/u
[Domain]User [/p Password]]]

FTPSite the name of the FTP site that should be deleted, started, stopped, or paused.

/s Computer, used to indicate that the script should run on this remote computer. The local computer is used
by default.

/u [Domain]User, the account credentials that must be used to delete, start, stop, or pause the FTP site on the
remote computer.

/p Password, the password of the account credentials (above).

To query FTP sites on the IIS servers, use

iisftp[.vbs] /query [FTPSite [FTPSite...]] [/s Computer [/u [Domain]User [/p Password]]]

To use /setadprop, and /getadprop use,

iisftp /SetADProp UserID {FTPDir|FTPRoot} PropertyValue [/s Computer [/u [Domain]User/p


Password]]

iisftp /GetADProp UserID [/s Computer [/u [Domain]User /p Password]]

UserID the Active Directory user login ID.

FTPDir indicates whether the modification is applicable at the directory level or at the root level.

PropertyValue indicates the home directory and relative path.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.
/u [Domain]User the account credentials that must be used for remote administration.

/p Password the password of the account credentials (above).

How to Use iisftpdr.vbs to Manage Virtual Directories


The iisftpdr.vbs command can be used to list virtual directories in a specified root and to create and delete virtual
directories in FTP sites from the command line.

To create a virtual directory for an FTP site, use:

iisftpdr /create FTPSite[VirtualPath] Name PhysicalPath [/s Computer [/u [Domain]User /p


Password]]

FTPSite the name of the FTP site that the virtual directory will be created for.

VirtualPath the virtual path under which this virtual directory should be created (optional).

Name the name of the new virtual directory.

PhysicalPath the name of physical directory where the virtual directory points.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to create the virtual directory on the remote
computer.

/p Password the password of the account credentials (above).

To delete a virtual directory associated with an FTP site, use:

iisftpdr /delete FTPSite[VirtualPath]/Name [/s Computer [/u [Domain]User /p Password]]

FTPSite the FTP site associated with the virtual directory to be deleted.

VirtualPath the virtual path that holds the virtual directory (optional).

Name the name of the virtual directory to be deleted.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to delete the virtual directory.

/p Password the password of the account credentials (above).

To query FTP specific virtual directories on IIS servers, use

iisftpdr /query FTPSite[/VirtualPath][/s Computer [/u [Domain]User/p Password]]

FTPSite the name of the FTP site associated with the virtual directory to be queried.

VirtualPath the virtual path that holds the virtual directory (optional).
/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to query for virtual directories remotely.

/p Password the password of the user account (above).

How to Use iiscnfg.vbs to Manage IIS from the Command Line


Users can use iiscnfg.vbs to import and export IIS configurations settings of the metabase as XML files.

To export IIS configuration settings, use:

iiscnfg /export /f [Path]FileName.xml /sp SourcePath [/d EncryptingPassword] [/inherited]


[/children] [/s Computer [/u [Domain]User [/p Password]]]

/f [Path]FileName.xml the name of the XML file that the configuration settings should be exported to.

/sp SourcePath the node of the metabase configuration settings.

/d EncryptingPassword the XML files password.

/inherited indicates that all inherited information should be exported.

/children indicates that node subkeys should be exported.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to run the script.

/p Password the password of the account credentials (above).

To import IIS configuration settings, use:

iiscnfg /import /f [Path]FileName.xml /sp SourcePath /dp DestinationPath [/d


EncryptingPassword] [/inherited] [/children] [/merge][/s Computer [/u [Domain]User [/p
Password]]]

/f [Path]FileName.xml the name of the XML file that should be used to import IIS configuration settings to
the server.

/sp SourcePath the node of the XML file.

/dp DestinationPath the destination node path in the metabase.

/d EncryptingPassword the XML files password.

/inherited indicates that all inherited information should be imported. This can only occur when the source
node has properties that can be inherited.

/children indicates that node subkeys should be imported.

/merge merges different source keys to one metabase key through this value.
/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to run the script.

/p Password the password of the user account (above).

To copy the metabase.xml file and metabase XML file to a different IIS server, use:

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

/ts TargetComputer the name or IP address of the IIS computer to which these configuration settings should
be copied.

tu TargetUser the user account for logging onto the target computer.

tp TargetPassword the password of the account provided above.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to run the script remotely.

/p Password the password of the account (above).

To immediately save configuration changes to the metabase, use:

iiscnfg /save [/s Computer [/u [Domain]User /p Password]]

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to run the script.

/p Password the password of the account (above).

How to Use iisback.vbs to Back Up IIS Configuration Settings and


Restore IIS Configurations
Use iisback.vbs to back up and restore IIS configuration settings from the command line.

To back up IIS configuration settings, use:

iisback /backup [/b BackupName] [/v {Integer | HIGHEST_VERSION | NEXT_VERSION}] [/overwrite]


[/e EncryptingPassword] [/s Computer [/u [Domain]User/p Password]]

/b BackupName, the name of the back up.

/v {Integer}, possible values are HIGHEST_VERSION or NEXT_VERSION. HIGHEST_VERSION creates


a backup of the highest version number. The HIGHEST_VERSION value has to be utilized with /overwrite.
NEXT_VERSION increments the existing version number by one.

/overwrite overwrites a current backup.

/e EncryptingPassword enables password encryption for the backup.


/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to create backups for the remote computer.

/p Password the password of the account credentials (above).

To restore IIS configuration settings, use:

iisback /restore /b BackupName [/v {Integer | HIGHEST_VERSION}] [/e EncryptionPassword] [/s


Computer [/u [Domain]Userp Password]]

/b BackupName the name of the backup file to be restored.

/v {Integer}, possible values are HIGHEST_VERSION or NEXT_VERSION.

/e EncryptingPassword the password for the backup.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to restore the backup file for the remote
computer.

/p Password the password of the account (above).

To list all IIS backups for an IIS server, use:

iisback /list [/s Computer [/u [Domain]User/p Password]]

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to list all backups for the remote computer.

/p Password the password of the account credentials (above).

To delete an IIS backup, use:

iisback /delete [/bBackupName] [/v {Integer | HIGHEST_VERSION}] [/s Computer [/u


[Domain]User /p Password]]

/bBackupName the name of the backup file to be deleted.

/v {Integer}, possible values are HIGHEST_VERSION or NEXT_VERSION.

/s Computer indicates that the script should run on this remote computer. The local computer is used by
default.

/u [Domain]User the account credentials that must be used to delete the backup file for the remote computer.

/p Password the password of the account credentials (above).

Follow Us!
0shares
0Like
0+1

Rate this article:

Using IIS Command-Line Utilities to Manage IIS, 5 / 5 (2 votes)


Mail this article
Print this article Last updated 11 March, 2016.

Related Posts

Troubleshooting IIS

Understanding HTTP Error Messages HTTP error messages are related to the HTTP status codes which ...

SSL and IIS

An Overview on Secure Sockets Layer (SSL) With IIS, you can further secure websites by ...
Publishing Content to IIS

Publishing Content using WebDAV You can use Web Distributed Authoring and Versioning (WebDAV) to manage ...

Reference

Software

Tutorials

Unit Conversion

Practice Tests

Web Tools

Site Index

Audio-Video

Databases

Electronics

File Compression

File Conversion

Gaming

Graphics

Hardware

Internet

IT Management

Macintosh

Microsoft Windows
Mobile Devices

Networking

Programming

Science

Security

Telephony

Unix

by Tech-FAQ
Copyright 2016 Independent Media | Reference the Tech-FAQ | Privacy Policy | Site Index
} 142 queries in 0.416 seconds.

Вам также может понравиться