I want to create a web application in IIS that does not live at the root of the IIS site.
i.e. MySite/beta/WebApplication.
This is my starting point:
Since some people use the term folder and Virtual Directory, I thought it would be worth posting how you create a New Web Application inside a Folder / Virtual Directory. Which looks like this in IIS Manager.
You simply need to use the Path as the site name.
Import-Module WebAdministration
$SiteName = "Act.Web.API" # IIS Site Name
New-WebVirtualDirectory -Site $SiteName -Name APFW-api -PhysicalPath C:\inetpub\wwwroot
New-WebApplication -Name Act.Web.API -Site $SiteName\APFW-api -PhysicalPath "C:\Program Files (x86)\ACT\APFW-api" -ApplicationPool $SiteAppPool
$SiteName\APFW-api equals "Act.Web.API\APFW-api" at run time so the highlighted application is created.