dsccommunity / dsccommunity/ComputerManagementDsc
ScheduledTask: Unable to enter Debug Mode
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 338
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
Details of the scenario you tried and the problem that is occurring
Enabling DSC debug with Enable-DSCDebug -BreakAll and then running the ScheduledTask resource returns an error:
PowerShell DSC resource MSFT_ScheduledTask failed to execute Test-TargetResource functionality with error message: Object reference not set to an instance of an object.
Verbose logs showing the problem
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = Resourcetest,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName'
= root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer REDACTED with user sid SID REDACTED.
WARNING: [REDACTED]: [DSCEngine] Warning LCM is in Debug 'ResourceScriptBreakAll' mode. Resource script processing will be stopped to wait for PowerShell script debugger to attach.
VERBOSE: [REDACTED]: [DSCEngine] Importing the module C:\ProgramData\PuppetLabs\puppet\cache\lib\puppet_x\dsc_resources\ComputerManagementDsc\DscResources\MSFT_ScheduledTask\MSFT_ScheduledTask.psm1 in force mode.
DEBUG: [REDACTED]: [DSCEngine]
namespace ScheduledTask
{
public enum DaysOfWeek
{
Sunday = 1,
Monday = 2,
Tuesday = 4,
Wednesday = 8,
Thursday = 16,
Friday = 32,
Saturday = 64
}
}
VERBOSE: [REDACTED]: LCM: [ Start Test ] [[ScheduledTask]DirectResourceAccess]
VERBOSE: [REDACTED]: [[ScheduledTask]DirectResourceAccess] Importing the module MSFT_ScheduledTask in force mode.
WARNING: [REDACTED]: [[ScheduledTask]DirectResourceAccess] Resource is waiting for PowerShell script debugger to attach. Use the following commands to begin debugging this resource script:
Enter-PSSession -ComputerName REDACTED -Credential <credentials>
Enter-PSHostProcess -Id 10792 -AppDomainName DscPsPluginWkr_AppDomain
Debug-Runspace -Id 2
VERBOSE: [REDACTED]: LCM: [ End Test ] [[ScheduledTask]DirectResourceAccess] False in 0.5150 seconds.PowerShell DSC resource MSFT_ScheduledTask failed to execute Test-TargetResource functionality with error message: Object reference not set to an instance of an object.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 1.603 seconds
Suggested solution to the issue
See the below issue for the same problem in a different DSC module:
https://github.com/PowerShell/SqlServerDsc/issues/448
The DSC configuration that is used to reproduce the issue (as detailed as possible)
No configuration to provide
The operating system the target node is running
OsName : Microsoft Windows Server 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.3053.amd64fre.rs1_release_inmarket.190612-1836
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.14393.3053
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3053
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
6.4.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect MSFT_ScheduledTask.psm1, especially Test-TargetResource, and reproduce the failure with Enable-DSCDebug -BreakAll and the ScheduledTask resource. Compare the behavior with the referenced SqlServerDsc issue. Done means the ScheduledTask resource completes debug-mode testing without the null-reference error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100