Modified cWebsite DSC Resource: Added net.pipe binding functionality + fixes

Hello All,

I have made some changes to the cWebsite resource. Specifically I needed to be able to create websites with the net.pipe binding. Here is a link to the zip with the .psm1 and .schema.mof files in my OneDrive:

Been emailing with Jason back and forth a bit and he recommended I share the updated resource here for feedback. I am confident I did not make the most efficient changes as I am most certainly no PS or DSC expert, so any thoughts you have on improvements or changes would be awesome.

Anyway, here is a brief change log (I have also commented all the added/modified code):

PSHOrg_cWebsite.schema.mof: Added net.pipe as a valid binding entry.

PSHOrg_cWebsite.psm1:
Line 70 and 71 - Added information on New-CimInstance error encountered (https://powershell.org/forums/topic/new-ciminstance-error/).

Line 702 - Updated command to get website bindings including net.pipe bindings.

Line 722 - Added counter for binding comparison loop. This helped fix a false negative when running test-dscconfiguration.

Line 725 - Incorporated counter in command to prevent multiple values being stored in variable.

Line 837 - Added if statement to prevent port parameters being added for net.pipe bindings.

Line 868 - Added if else statement to prevent binding creation command from running for net.pipe bindings as the command cannot successfully create net.pipe bindings. Else block with run the proper command to create net.pipe binding.

Line 918 - Added if statement to prevent net.pipe bindings from being split into individual sections for comparison.

Line 939 - Added if else statement to return appropriate properties for a net.pipe binding.

A couple gotchas you may need to know are:

  1. net.pipe bindings in your configuration need to look like this:
cWebSite default {
            Name = 'Default Web Site'
            PhysicalPath = '%SystemDrive%\inetpub\wwwroot'
            DependsOn = '[WindowsFeature]webserver','[Service]netPipeService'
            BindingInfo = @(
                PSHOrg_cWebBindingInformation 
                {
                    Protocol = 'net.pipe'
                }
                PSHOrg_cWebBindingInformation 
                {
                    Protocol = 'HTTP'
                    Port     = 80
                    IPAddress = '*'
                }
            )
            Ensure = 'Present'
        }
  1. In order for IIS to make sense of your website after adding a net.pipe binding, you will need to start the net.pipe service in Windows. Hence the DependsOn = ‘[Service]netPipeService’ portion of the configuration.

Let me know if there are any changes I should make or anything else I should do with this. Any feedback or testing would be great!
Thanks!

-James