Skip to content
This repository was archived by the owner on May 15, 2018. It is now read-only.
This repository was archived by the owner on May 15, 2018. It is now read-only.

Issues using ScheduledTask  #7

@kevinsea

Description

@kevinsea

I'm trying to use DSC to create scheduled tasks. I run the code below and it appears successful and there are no issues in the event log, but a task is not created.

Configuration Misc
{
    param([PSCredential] $creds)

    Import-DscResource -ModuleName  StackExchangeResources

    Node localhost
    {

        ScheduledTask Test_Task
        {
            Ensure = "Present"
            Name = "Proto2"
            FilePath = "D:\DSCTest\myapp.exe"  
            At = "11:00"
            Credential = $creds
            Daily = $true
            #sint32 Hours; sint32 Minutes; boolean Once; int32 DaysInterval; string DaysOfWeek[]; boolean Weekly;   
        }

    }
}

cls


$myCreds = New-Object System.Management.Automation.PSCredential("NT AUTHORITY\NETWORK SERVICE") 

#I've also tried supply my admin creds $myCreds = Get-Credential

Misc($myCreds)  -OutputPath "C:\Admin\TestingStuff\PS\DSC1\Misc"

Start-DscConfiguration -Path "C:\Admin\TestingStuff\PS\DSC1\Misc" -Wait -Verbose -Force -Debug 

Results:
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer USB-TGKCTEST with user sid S-1-5-21-2950772361-2964733660-914393307-1001.
VERBOSE: [USB-TGKCTEST]: LCM: [ Start Set ]
VERBOSE: [USB-TGKCTEST]: LCM: [ Start Resource ] [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
VERBOSE: [USB-TGKCTEST]: LCM: [ Start Test ] [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
VERBOSE: [USB-TGKCTEST]: [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
Unable to find matching job.
VERBOSE: [USB-TGKCTEST]: LCM: [ End Test ] [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
in 0.5160 seconds.
VERBOSE: [USB-TGKCTEST]: LCM: [ Start Set ] [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
VERBOSE: [USB-TGKCTEST]: LCM: [ End Set ] [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
in 0.9530 seconds.
VERBOSE: [USB-TGKCTEST]: LCM: [ End Resource ] [[ScheduledTask]Test_Task::[Misc]System.Management.Automation.PSCredential::[Misc]System.Management.Automation.PSCredential]
VERBOSE: [USB-TGKCTEST]: LCM: [ End Set ] in 1.8358 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.025 seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions