Skip to content

Commit 801a9be

Browse files
committed
I can haz more logging
1 parent aaac06e commit 801a9be

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ function Get-TargetResource
6262
$repetition = $trigger.Repetition
6363
$returnScheduleType = "Unknown"
6464
$returnInveral = 0
65+
Write-Verbose -Message "Duration: '$($repetition.Duration)'"
66+
Write-Verbose -Message "Interval: '$($repetition.Interval)'"
6567
if ($repetition.Duration -eq $null -and $repetition.Interval -eq $null)
6668
{
6769
$returnScheduleType = "Daily"

Tests/Unit/MSFT_xScheduledTask.Tests.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
2+
param(
3+
)
4+
15
$Global:DSCModuleName = 'xComputerManagement'
26
$Global:DSCResourceName = 'MSFT_xScheduledTask'
37

@@ -332,15 +336,12 @@ try
332336
}
333337

334338
Context "A scheduled task exists and is configured with the wrong execution account" {
335-
# Ignoring this because we need to generate a stub credential to use in unit tests
336-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
337-
$credential = New-Object System.Management.Automation.PSCredential ("DEMO\RightUser", (ConvertTo-SecureString "ExamplePassword" -AsPlainText -Force))
338339
$testParams = @{
339340
TaskName = "Test task"
340341
ActionExecutable = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
341342
ScheduleType = "Minutes"
342343
RepeatInterval = 15
343-
ExecuteAsCredential = $credential
344+
ExecuteAsCredential = New-Object System.Management.Automation.PSCredential ("DEMO\RightUser", (ConvertTo-SecureString "ExamplePassword" -AsPlainText -Force))
344345
}
345346

346347
Mock Get-ScheduledTask { return @{

0 commit comments

Comments
 (0)