Allow removing the OneShot listener
This commit is contained in:
parent
a87ea25c15
commit
f70cad941f
1 changed files with 10 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../Types/OneShotTask.ps1";
|
||||
$oneShotTaskName = "PortValhalla OneShot";
|
||||
$logName = "Application";
|
||||
$oneShotTrigger = 1337;
|
||||
$taskOption = "OneShotTask";
|
||||
|
@ -50,10 +51,18 @@ $null = New-Module {
|
|||
$trigger = (Get-ScheduledTask $tempTask).Triggers;
|
||||
$principal = New-ScheduledTaskPrincipal -UserId (Get-SetupUser) -RunLevel Highest;
|
||||
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger;
|
||||
$null = Register-ScheduledTask -Force "PortValhalla OneShot" -InputObject $task;
|
||||
$null = Register-ScheduledTask -Force $oneShotTaskName -InputObject $task;
|
||||
$null = Unregister-ScheduledTask -Confirm:$false $tempTask;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes the OneShot task.
|
||||
#>
|
||||
function Disable-OneShotListener {
|
||||
Unregister-ScheduledTask -Confirm:$false $oneShotTaskName;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Invokes a one-shot task.
|
||||
|
|
Loading…
Reference in a new issue