PowerShellOrg / StackExchangeResources

DSC Resources from Stack Exchange
MIT License
13 stars 8 forks source link

Set doesn't merge an existing resource #1

Closed craig-martin closed 9 years ago

craig-martin commented 9 years ago

Looks like the Set-TargetResource method isn't handling an existing scheduled task. Here's the repro, run directly instead of through the LCM:

ipmo 'C:\Program Files\WindowsPowerShell\Modules\StackExchangeResources\DSCResources\StackExchange_ScheduledTask' -Force

$testResourceProperties = @{
    Name        = 'testTask'
    FilePath    = 'C:\Temp\foo.ps1'
    At          = [DateTime]::Now.ToString()
    Hours       = 1
    Daily       = $true
    Ensure      = 'Present'
}

### Expect this to create the task: SUCCESS
Set-TargetResource  @testResourceProperties -Verbose:$true

### Expect this to update the task: FAIL (Register-ScheduledJob : The scheduled job definition FIM Sync Daily Delta already exists in the job definition store.)
Set-TargetResource  @testResourceProperties -Verbose:$true
dlwyatt commented 9 years ago

Fixed by #2 .