description | ms.custom | ms.date | ms.topic | title |
---|---|---|---|---|
Use Identical Parameters For DSC Test and Set Functions |
PSSA v1.21.0 |
06/28/2023 |
reference |
DSCUseIdenticalParametersForDSC |
Severity Level: Error
The Get-TargetResource
, Test-TargetResource
and Set-TargetResource
functions of DSC Resource
must have the same parameters.
Correct the parameters for the functions in DSC resource.
function Get-TargetResource
{
[OutputType([Hashtable])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
function Set-TargetResource
{
param
(
[parameter(Mandatory = $true)]
[String]
$Name
)
...
}
function Test-TargetResource
{
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name
)
...
}
function Get-TargetResource
{
[OutputType([Hashtable])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
function Set-TargetResource
{
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
function Test-TargetResource
{
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}