Book Image

Getting Started with Powershell

Book Image

Getting Started with Powershell

Overview of this book

Table of Contents (19 chapters)
Getting Started with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Next Steps
Index

Creating virtual directories and web applications


Virtual directories and web applications are the different options to contain content in IIS. A virtual directory is a pointer to a location on the disk where the content actually resides. A web application, in the IIS terminology, is a virtual directory that also has the ability to run in a different worker process than its parent.

To create a virtual directory, we will use the New-WebVirtualDirectory cmdlet and supply the –Name and –PhysicalPath parameters. Also, we will need to specify the site and we can do this in one of the following two ways:

  1. Use Set-Location (CD) in the IIS drive and navigate to the desired site.

  2. Specify the site on the command line.

In the following screenshot, we will illustrate the first method:

If you are working with a website besides the default site (Default Web Site), you will need to set the location to this site. For instance, to create a virtual directory in the Test site, you would use Set-Location IIS:\Sites...