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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With