Skip to content

Commit 0763bd0

Browse files
committed
Added cleanup task for integration test
Cleans up any leftover tasks and removes the task folder that will invariably be created
1 parent 4a2cee6 commit 0763bd0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,15 @@ try
373373
finally
374374
{
375375
#region FOOTER
376+
377+
# Remove any traces of the created tasks
378+
Get-ScheduledTask -TaskPath '\xComputerManagement\' -ErrorAction SilentlyContinue | Unregister-ScheduledTask -ErrorAction SilentlyContinue -Confirm:$false
379+
380+
$scheduler = New-Object -ComObject Schedule.Service
381+
$scheduler.Connect()
382+
$rootFolder = $scheduler.GetFolder('\')
383+
$rootFolder.DeleteFolder('xComputerManagement', 0)
384+
376385
Restore-TestEnvironment -TestEnvironment $TestEnvironment
377386
#endregion
378387
}

0 commit comments

Comments
 (0)