I have been trying to figure out a nice way to conditionally specify parameters to a DSC resources based on Configuration parameters.
Configuration WebsiteConfiguration { param ( [Parameter(Mandatory=$false)] $PSCred ) Node ('localhost') { xWebAppPool NewWebAppPool { Name = 'MyWebsite' Ensure = "Present" State = "Started" AutoStart = $true ManagedPipelineMode = 'Integrated' ManagedRuntimeVersion = 'v4.0' StartMode = 'OnDemand' LoadUserProfile = $false Credential = $PSCred } } }
Here in the above configuration, I want to specify the $PSCred parameter to Credential property only if specified by Configuration caller else not.
I’using WMF 5.1
Any help ideas or pointers are appreciated.
Thanks