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

ScheduledTask: Type mismatch with MultipleInstances option #255

Closed
bozho opened this issue Aug 28, 2019 · 2 comments · Fixed by #256
Closed

ScheduledTask: Type mismatch with MultipleInstances option #255

bozho opened this issue Aug 28, 2019 · 2 comments · Fixed by #256
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@bozho
Copy link
Contributor

bozho commented Aug 28, 2019

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

MultipleInstances option is a String. However, Get-TargetResource returns it as Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum, which causes Test-TargetResource function to always return $false.

Verbose logs showing the problem

VERBOSE: [TEST-SERVER]:                            [[ScheduledTask]MyScheduledTask] NOTMATCH: Type mismatch for property 'MultipleInstances' Current state type is                                            'Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum' and desired type is 'System.String'.                                                                                                                              

Suggested solution to the issue

Test-TargetResource could convert $currentValues['MultipleInstances'] value from enum to String

Alternatively, Get-TargetResource could do the enum -> string conversion.

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

# insert configuration here

The operating system the target node is running

Version and build of PowerShell the target node is running

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

6.5.0.0

@PlagueHO
Copy link
Member

This is easier to do now that this has been refactored. I'd suggest casting at this line: https://github.com/PowerShell/ComputerManagementDsc/blob/dev/DSCResources/MSFT_ScheduledTask/MSFT_ScheduledTask.psm1#L1816

@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Aug 29, 2019
@bozho
Copy link
Contributor Author

bozho commented Aug 29, 2019

I agree. I'll submit the patch during the day.

bozho added a commit to bozho/ComputerManagementDsc that referenced this issue Aug 29, 2019
bozho added a commit to bozho/ComputerManagementDsc that referenced this issue Sep 4, 2019
PlagueHO added a commit that referenced this issue Sep 6, 2019
[#255] Fixed type mismatch for MultipleInstances
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. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants