dsccommunity / WebAdministrationDsc

This module contains DSC resources for deploying and configuring web servers and related components.
MIT License
162 stars 148 forks source link

Adding a Sub Virtual Directory Under a Virtual Directory #336

Open n8yeung opened 6 years ago

n8yeung commented 6 years ago

I'm trying to use the xWebAdministration to add a sub virtual directory under a virtual directory and I'm unable to create the sub-virtual directory within the virtual directory. Here's what I've tried so far:

            if($_.Name -match "Images" -and $_.Website -match "Website") {                   
                $AdminImagesVirtualDirectory = xWebVirtualDirectory "$($_.Website)_$($_.Name)_$($_.WebApplication)_Virt".Replace(" ","").Replace("/","_")
                {
                    Name = $_.Name
                    Ensure = $_.Ensure
                    Website = $_.Website
                    PhysicalPath = $PhysicalPath
                    WebApplication = $_.WebApplication
                    DependsOn = $_.DependsOn
                }
            } elseif ($_.Name -match "Common" -and $_.Website -match "Website") {
                xWebVirtualDirectory "$($_.Website)_$($AdminImagesVirtualDirectory.Name)_$($_.Name)_$($_.WebApplication)_Virt".Replace(" ","").Replace("/","_")
                {
                    Name = $_.Name
                    Ensure = $_.Ensure
                    Website = $_.Website
                    PhysicalPath = $PhysicalPath
                    WebApplication = $_.WebApplication
                    DependsOn = $_.DependsOn
                }
            } 

Basically, I am creating the images virtual directory first and then I'm trying to create the Common subdirectory under the images virtual directory. Is this supported?

Is there a way a better way to do this with xWebAdministration?

n8yeung commented 6 years ago

I was able to create a sub virtual directory by using images/common for the Name

johlju commented 6 years ago

Thanks for reporting this. Glad you found a solution. This should be documented, maybe as an example, and it should be added as an integration test.