title: How can I convert a normal folder under a website in a file share to an application via Powershell?
body: <p>After trying to use <code>ConvertTo-Application</code> and <code>New-WebApplication</code>, I've had no luck converting a folder to an app when it's located on a network share.
  I receive a <code>"Path doesn't belong to 'WebAdministration' provider"</code></p>
  
  <p>I've scoured the internet trying to find a solution, including several links from stackoverflow. 
  Basically I'm making a GUI script to create a website, convert folders to webapps, I have two comboboxes for selecting current websites and AppPools. The GUI also let's me create AppPools. The GUI works great, but I'm just trying to get this one feature of it going. </p>
  
  <p>This feature of the script is something that is required by management.</p>
  
  <pre><code>New-WebApplication -Name $Name2 -Site $SiteN -PhysicalPath $Path -ApplicationPool $AppP
  </code></pre>
  
  <p>(also)</p>
  
  <pre><code>ConvertTo-WebApplication -PSPath "\\domain.local\webstuff\WebSites\Dev\Internet\foldername\scriptdevsite\scriptdevsite2\SiteApp1"
  </code></pre>
  
  <p>Now, I realize that <code>ConvertTo-WebApplication</code> is for converting Virtual Directories to apps, but I wanted to try this and see if it'll work.
  The <code>New-Website</code> command works great, but it makes apps and leaves the folders.
  So I'll get scriptdevsite2\SiteApp1\SiteApp1, not going to work. 
  We have websites that have physical folders that sometimes need to be converted to an application and occasionally removed for testing. </p>
  
  <p>Likely going to have to implement some C# for this, I've been checking into <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.administration.application?view=iis-dotnet" rel="nofollow noreferrer">Application Class</a>. 
  But it's not very helpful, at least not to me. </p>
  
  <p>I'm still new to this site, so if there's anything I'm leaving out, I apologize in advance.
  Thank you for your help</p>