Summary of the new feature / enhancement
psresourcelist.dsc.resource.json implements what-if through the top-level whatIf manifest operation. DSC deprecated that operation in 3.2.0 in favour of set.whatIfArg, where the engine appends an argument to the normal set command instead of running a separate command. Staying on whatIf means a deprecation warning today and a break when the property is removed.
Current manifest:
"whatIf": {
"executable": "pwsh",
"args": [ "-NoLogo", "-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command",
"$Input | ./psresourceget.ps1 -resourcetype 'psresourcelist' -operation set -WhatIf; exit $LASTEXITCODE" ],
"input": "stdin",
"return": "state"
}
Proposed technical implementation details (optional)
- Replace the
whatIf block with "whatIfArg": "-WhatIf" inside set.
whatIfArg is appended after the existing args, which does not work with -Command "...". Switch set to -File ./psresourceget.ps1 -ResourceType psresourcelist -Operation set so the appended -WhatIf binds to the script's [switch]$WhatIf. Verified locally that pwsh -File with stdin input works for this script.
- Bump
$schema on both manifests to a version that includes whatIfArg and set the minimum supported DSC version to 3.2.0 in the README.
- While in the manifests, the
Repository manifest's -Command invocations should also gain ; exit $LASTEXITCODE or move to -File
Summary of the new feature / enhancement
psresourcelist.dsc.resource.jsonimplements what-if through the top-levelwhatIfmanifest operation. DSC deprecated that operation in 3.2.0 in favour ofset.whatIfArg, where the engine appends an argument to the normalsetcommand instead of running a separate command. Staying onwhatIfmeans a deprecation warning today and a break when the property is removed.Current manifest:
Proposed technical implementation details (optional)
whatIfblock with"whatIfArg": "-WhatIf"insideset.whatIfArgis appended after the existingargs, which does not work with-Command "...". Switchsetto-File ./psresourceget.ps1 -ResourceType psresourcelist -Operation setso the appended-WhatIfbinds to the script's[switch]$WhatIf. Verified locally thatpwsh -Filewith stdin input works for this script.$schemaon both manifests to a version that includeswhatIfArgand set the minimum supported DSC version to 3.2.0 in the README.Repositorymanifest's-Commandinvocations should also gain; exit $LASTEXITCODEor move to-File