Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created December 18, 2015 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/ca95659b3b51faf8751e to your computer and use it in GitHub Desktop.
Save guitarrapc/ca95659b3b51faf8751e to your computer and use it in GitHub Desktop.
New Resource in WMFv5 RTM
Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1"
Configuration WindowsOptionalFeatureSet
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.String[]]
$Name,
[Parameter(Mandatory=$true)]
[ValidateSet('Enable','Disable')]
[System.String]
$Ensure,
[ValidateNotNullOrEmpty()]
[System.String[]]
$Source,
[System.Boolean]
$RemoveFilesOnDisable,
[ValidateNotNullOrEmpty()]
[System.String]
$LogPath,
[System.Boolean]
$NoWindowsUpdateCheck,
[ValidateSet('ErrorsOnly','ErrorsAndWarning','ErrorsAndWarningAndInformation')]
[System.String]
$LogLevel
)
$psboundParams = $PSBoundParameters
$optionalParameters = @("Ensure","Source","RemoveFilesOnDisable","LogPath","NoWindowsUpdateCheck","LogLevel")
$keyParamName = "Name"
$resourceName = "WindowsOptionalFeature"
#build common parameters for all WindowsOptionalFeature resource nodes
[string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams
#build WindowsOptionalFeature resource string
[string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName
$configScript = [scriptblock]::Create($resourceString)
. $configScript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment