PowerShell-Docs icon indicating copy to clipboard operation
PowerShell-Docs copied to clipboard

Target property is valid property?

Open tksh164 opened this issue 6 years ago • 2 comments

The Target property of Environment DSC resource is valid property?

The member 'Target' is not valid. Valid members are 'DependsOn', 'Ensure', 'Name', 'Path', 'PsDscRunAsCredential', 'Value'.

VS Code with PowerShell extension: image

Azure Automation State Configuration: image


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

tksh164 avatar Sep 09 '20 07:09 tksh164

Hey @tksh164, I'm sorry for your issue. This doc is correct. You might want to try using the PSDscResources which is the currently supports module holding dsc resources.

chasewilson avatar Sep 09 '20 16:09 chasewilson

@chasewilson - Thank you for your confirmation. I confirmed at MSFT_EnvironmentResource.schema.mof

If so, the correct data type is string[] right? Because the definition of Target property is the array of string.

docs:

[ Target = [string] { Process | Machine } ]

PSDscResources repo:

[Write, Description("Indicates the target where the environment variable should be set."), ValueMap{"Process", "Machine"}, Values{"Process", "Machine"}] String Target[];

P.S. The Description property of Group resource is the same (opposite). That data type is mismatched with the definition.

https://docs.microsoft.com/en-us/powershell/scripting/dsc/reference/resources/windows/groupresource

[ Description = [string[]] ]

https://github.com/PowerShell/PSDscResources/blob/7064eda52d939a4a3ce40e1f38756cfe6a09acfd/DscResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof#L7

[Write, Description("The description the group should have.")] String Description;

tksh164 avatar Sep 10 '20 05:09 tksh164