Author Posts

December 12, 2016 at 5:20 pm

hello
trying to create a new virtual directory under dsc. I can get the share using windows explorer and from the GUI of IIS.

here is what I have for the new virtual directory
@{
Name = 'archive'
PhysicalPath = '\\nt2.123.com\Q$\Lesso\Archive'
Ensure = 'Present'
}
the errors :
Cannot find path 'IIS:\Sites\lesso.123.com\archive' because it does not exist.
+ CategoryInfo : ObjectNotFound: (IIS:\Sites\less...123.com\archive:) [], CimException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand
+ PSComputerName : APP1

The PowerShell DSC resource 123_cVirtualDirectory threw one or more non-terminating errors while running the Set-TargetResource
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : APP1

December 12, 2016 at 6:53 pm

I'm not certain the WebSite resource is presently geared to accept UNCs. Look at its code (https://github.com/PowerShell/xWebAdministration/blob/dev/DSCResources/MSFT_xWebsite/MSFT_xWebsite.psm1), it's attempting to use the IIS: drive created by the WebAdministration module:

                Set-ItemProperty -Path "IIS:\Sites\$Name" `
                                 -Name physicalPath `
                                 -Value $PhysicalPath `
                                 -ErrorAction Stop


to set the physical path. Try manually running that yourself in a normal PowerShell console, using your correct values, and see what you get.