Author Posts

June 3, 2016 at 5:33 am

Hi, I installed a xwebAdministration module from powershell gallery and used the xWebsite example with minor changes. When I tried to run the script it resulted to this:

The command Test-TargetResource of the PS module MSFT_xWebsite does not implement the write property
EnabledProtocols mentioned in the corresponding MOF schema file C:\Program
Files\WindowsPowerShell\Modules\xWebAdministration\DscResources\MSFT_xWebsite\MSFT_xWebsite.schema.mof. All write
paramenters mentioned in the schema file must be implemented by the command Test-TargetResource.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : WriteParameterNotImplemented
+ PSComputerName : localhost

Here's my script below:

Configuration webSetup
{
param
(
# Target nodes to apply the configuration
[string[]]$NodeName = 'localhost',
# Name of the website to create
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$WebSiteName,

# Create a protocol
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Protocol,

# Create a port
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Port,

# Create an IP Address
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$IPAdd,

# Create an Application Pool
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$AppPool

)

# Import the module that defines custom resources
Import-DscResource -Module xWebAdministration
Node $NodeName
{
# Install the IIS role
WindowsFeature IIS
{
Ensure = "Present"
Name = "Web-Server"
}

# Install the ASP .NET 4.5 role
WindowsFeature AspNet45
{
Ensure = "Present"
Name = "Web-Asp-Net45"
}

# Create the new Website
xWebsite NewWebsite
{
Ensure = "Present"
Name = $WebSiteName
State = "Started"
PhysicalPath = "C:\inetpub\wwwroot"
ApplicationPool = $AppPool
BindingInfo = @(
MSFT_xWebBindingInformation
{
Protocol = $Protocol
Port = $Port
IPAddress = $IPAdd
})

}
}
}

webSetup

Start-DscConfiguration -Force -Wait -Verbose -Path .\webSetup

June 3, 2016 at 5:41 am

That's odd. I've downloaded the module (v1.11.0.0) from the gallery, and the functions all look correct. Are you sure you haven't somehow got a copy of the psm1 file from an older version, but the newer schema.mof file?

June 3, 2016 at 5:48 am

hi Dave, yep. I used "Install-Module -Name xWebAdministration" to get it installed in my ISE. What I actually want to do is to allow the user enter the website name, port, ip address, application pool, and etc. But yea, it appears it doesn't allow me to do that. When I use the old version, it allows me the user input. The problem is it doesn't have authentication which the new version has.