DscResources/TestRes/TestRes.psm1
function Set-TargetResource { [CmdletBinding()] param ( [Parameter(Mandatory)] [System.String] $propName, [PSObject] $EmbClassObj ) Set-StrictMode -Version Latest if ($propName -ne $EmbClassObj.EmbClassProp) { Write-Error "Set-TargetResource failed. propName:$propName EmbClassProp:$($EmbClassObj.EmbClassProp)" } } function Test-TargetResource { [CmdletBinding()] [OutputType([System.Boolean])] param ( [Parameter(Mandatory)] [System.String] $propName, [PSObject] $EmbClassObj ) return $EmbClassObj.EmbClassProp -eq $propName } function Get-TargetResource { [CmdletBinding()] [OutputType([Hashtable])] param ( [Parameter(Mandatory)] [System.String] $propName, [PSObject] $EmbClassObj ) if ($propName -eq $EmbClassObj.EmbClassProp) { $result = @{ propName=$propName EmbClassObj=$EmbClassObj } } else { $result = @{ propName="propName doesn't match EmbClassProp" EmbClassObj=@{EmbClassProp = 'EmbClassProp doesnt match propName'} } } return $result } Export-ModuleMember -Function Test-TargetResource, Set-TargetResource, Get-TargetResource |