Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowsCapability - Test-TargetResource fails #297

Closed
davehl7 opened this issue Jan 20, 2020 · 2 comments · Fixed by #299
Closed

WindowsCapability - Test-TargetResource fails #297

davehl7 opened this issue Jan 20, 2020 · 2 comments · Fixed by #299
Assignees
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@davehl7
Copy link

davehl7 commented Jan 20, 2020

An attempt to test WindowsCapability resource fails.

Details of the scenario you tried and the problem that is occurring

Trying to handle capability resource 'SNMP.Client~~~~0.0.1.0' via following script:
WindowsCapability SNMP {
Name = 'SNMP.Client~~~~0.0.1.0'
Ensure = 'Present'
}

Verbose logs showing the problem

VERBOSE: An LCM method call arrived from computer COMP-XYZ with user sid S-1-5-21-xyz.
VERBOSE: [COMP-XYZ]: LCM: [ Start Compare ]
VERBOSE: [COMP-XYZ]: LCM: [ Start Resource ] [[WindowsCapability]SNMP::[WindowsFeatures]DefaultOSFeatures]
VERBOSE: [COMP-XYZ]: LCM: [ Start Test ] [[WindowsCapability]SNMP::[WindowsFeatures]DefaultOSFeatures]
VERBOSE: [COMP-XYZ]: [[WindowsCapability]SNMP::[WindowsFeatures]DefaultOSFeatures] Begin executing Test functionality on Windows Capability
'SNMP.Client~~~~0.0.1.0'.
A parameter cannot be found that matches parameter name 'Ensure'.
+ CategoryInfo : InvalidArgument: (:) [], CimException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Dism.Commands.GetWindowsCapabilityCommand

PowerShell Desired State Configuration does not support execution of commands in an interactive mode. Please ensure that the underlying command is not prompting for user
input, such as missing mandatory parameter, confirmation prompt etc.
+ CategoryInfo : OperationStopped: (:) [], CimException
+ FullyQualifiedErrorId : System.NotSupportedException

Suggested solution to the issue

It seems that Test-TargetResource passes unexpected parameters to Get-WindowsCapability. Parameter set should be handled in a similar way as in Set-TargetResource.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

	WindowsCapability SNMP {
		Name = 'SNMP.Client~~~~0.0.1.0'
		Ensure = 'Present'
	}

The operating system the target node is running

Windows 10 1709 Enterprise

Version and build of PowerShell the target node is running

PSVersion 5.1.16299.1146
PSEdition Desktop

Version of the DSC module that was used ('dev' if using current dev branch)

Using ComputerManagementDsc version 7.1.0.0.

@PlagueHO PlagueHO added help wanted The issue is up for grabs for anyone in the community. needs investigation The issue needs to be investigated by the maintainers or/and the community. labels Jan 21, 2020
@PlagueHO
Copy link
Member

Hi @davehl7 - this does seem to be the case. There is a missing default parameter on the Ensure (https://github.com/dsccommunity/ComputerManagementDsc/blob/dev/DSCResources/MSFT_WindowsCapability/MSFT_WindowsCapability.psm1#L170) as well as a missing command:

$null = $PSBoundParameters.Remove('Ensure')

I'm not sure why the unit tests didn't pick this up. So I'll need to fix these. I'll fix this at the same time as migrating to the new CI process.

@PlagueHO PlagueHO added bug The issue is a bug. and removed needs investigation The issue needs to be investigated by the maintainers or/and the community. labels Jan 21, 2020
@PlagueHO PlagueHO self-assigned this Jan 21, 2020
@PlagueHO PlagueHO added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Jan 21, 2020
@PlagueHO
Copy link
Member

Still working on this, but should be finished in the next day or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants