Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS new virtual directory. Getting "Parent node has no children of type virtualDirectory".error

I am trying to add my web project folder to IIS as virtual directory using the following powershell command but I am getting the error. Wondering if I am missing something. Thanks.

PS C:\Users\Administrator> New-WebVirtualDirectory -name 'sy' -site 'sy site' -PhysicalPath 'C:\Projects\buoy'
New-WebVirtualDirectory : Parent node has no children of type virtualDirectory.
Parameter name: path
At line:1 char:1
+ New-WebVirtualDirectory -name 'sy' -site 'sy site' -PhysicalPath 'C:\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-WebVirtualDirectory], ArgumentException
    + FullyQualifiedErrorId : Parent node has no children of type virtualDirectory.
Parameter name: path,Microsoft.IIs.PowerShell.Provider.NewVirtualDirectoryCommand
like image 577
RedFox Avatar asked Oct 16 '25 16:10

RedFox


2 Answers

I saw this error when the web site (e.g. "Default Web Site") did not exist.

If you are using a different site name, make sure it exists on the web server under the 'sites' node in IIS. That is the 'parent node' to which your error refers.

like image 118
Paul Avatar answered Oct 18 '25 11:10

Paul


Try:

New-WebVirtualDirectory -Site "Default Web Site" -Name Wyse -PhysicalPath C:\inetpub\wwwroot

Went to: https://learn.microsoft.com/en-us/powershell/module/webadminstration/new-webvirtualdirectory?view=winserver2012-ps

and removed the quotes from the -name and the -physicalpath and used the double quotes on the -site, then it worked. I was originally trying -site 'IIS:\Sites\Default Web Site'. Hope this helps.

like image 28
brican Avatar answered Oct 18 '25 12:10

brican