@@ -212,8 +212,18 @@ Get-Module $ModuleName | Remove-Module
212
212
213
213
# Import the required version
214
214
Import-Module $ModuleName - RequiredVersion $RequiredVersion - ErrorAction Stop
215
- $ms = [Microsoft.PowerShell.Commands.ModuleSpecification ]@ { ModuleName = $ModuleName ; RequiredVersion = $RequiredVersion }
216
- $commands = Get-Command - FullyQualifiedModule $ms - CommandType Cmdlet, Function, Workflow # Not alias
215
+ $ms = $null
216
+ $commands = $null
217
+ $paramBlackList = @ ()
218
+ if ($PSVersionTable.PSVersion -lt [Version ]' 5.0' ) {
219
+ $ms = New-Object - TypeName ' Microsoft.PowerShell.Commands.ModuleSpecification' - ArgumentList $ModuleName
220
+ $commands = Get-Command - Module $ms.Name
221
+ $paramBlackList += ' SaveDscDependency'
222
+ }
223
+ else {
224
+ $ms = [Microsoft.PowerShell.Commands.ModuleSpecification ]@ { ModuleName = $ModuleName ; RequiredVersion = $RequiredVersion }
225
+ $commands = Get-Command - FullyQualifiedModule $ms - CommandType Cmdlet, Function, Workflow # Not alias
226
+ }
217
227
218
228
# # When testing help, remember that help is cached at the beginning of each session.
219
229
# # To test, restart session.
@@ -265,6 +275,9 @@ foreach ($command in $commands) {
265
275
$HelpParameterNames = $Help.Parameters.Parameter.Name | Sort-Object - Unique
266
276
267
277
foreach ($parameter in $parameters ) {
278
+ if ($parameter -in $paramBlackList ) {
279
+ continue
280
+ }
268
281
$parameterName = $parameter.Name
269
282
$parameterHelp = $Help.parameters.parameter | Where-Object Name -EQ $parameterName
270
283
@@ -291,6 +304,9 @@ foreach ($command in $commands) {
291
304
}
292
305
293
306
foreach ($helpParm in $HelpParameterNames ) {
307
+ if ($helpParm -in $paramBlackList ) {
308
+ continue
309
+ }
294
310
# Shouldn't find extra parameters in help.
295
311
It " finds help parameter in code: $helpParm " {
296
312
$helpParm -in $parameterNames | Should Be $true
0 commit comments