Added ScheduledTaskHourly to New-UserPersistenceOption
This commit is contained in:
parent
a6564f4483
commit
75a37a0f17
|
|
@ -229,6 +229,10 @@ function New-UserPersistenceOption
|
|||
|
||||
Starts the payload daily.
|
||||
|
||||
.PARAMETER Hourly
|
||||
|
||||
Starts the payload hourly.
|
||||
|
||||
.PARAMETER At
|
||||
|
||||
Starts the payload at the specified time. You may specify times in the following formats: '12:31 AM', '2 AM', '23:00:00', or '4:06:26 PM'.
|
||||
|
|
@ -248,6 +252,7 @@ function New-UserPersistenceOption
|
|||
|
||||
[CmdletBinding()] Param (
|
||||
[Parameter( ParameterSetName = 'ScheduledTaskDaily', Mandatory = $True )]
|
||||
[Parameter( ParameterSetName = 'ScheduledTaskHourly', Mandatory = $True )]
|
||||
[Parameter( ParameterSetName = 'ScheduledTaskOnIdle', Mandatory = $True )]
|
||||
[Switch]
|
||||
$ScheduledTask,
|
||||
|
|
@ -260,6 +265,10 @@ function New-UserPersistenceOption
|
|||
[Switch]
|
||||
$Daily,
|
||||
|
||||
[Parameter( ParameterSetName = 'ScheduledTaskHourly', Mandatory = $True )]
|
||||
[Switch]
|
||||
$Hourly,
|
||||
|
||||
[Parameter( ParameterSetName = 'ScheduledTaskDaily', Mandatory = $True )]
|
||||
[DateTime]
|
||||
$At,
|
||||
|
|
@ -300,6 +309,12 @@ function New-UserPersistenceOption
|
|||
$PersistenceOptionsTable['Time'] = $At
|
||||
}
|
||||
|
||||
'ScheduledTaskHourly'
|
||||
{
|
||||
$PersistenceOptionsTable['Method'] = 'ScheduledTask'
|
||||
$PersistenceOptionsTable['Trigger'] = 'Hourly'
|
||||
}
|
||||
|
||||
'Registry'
|
||||
{
|
||||
$PersistenceOptionsTable['Method'] = 'Registry'
|
||||
|
|
@ -637,6 +652,11 @@ Get-WmiObject __FilterToConsumerBinding -Namespace root\subscription | Where-Obj
|
|||
$UserTrigger = "schtasks /Create /SC DAILY /ST $($UserPersistenceOption.Time.ToString('HH:mm:ss')) /TN Updater /TR "
|
||||
}
|
||||
|
||||
'Hourly'
|
||||
{
|
||||
$UserTrigger = "schtasks /Create /SC HOURLY /TN Updater /TR "
|
||||
}
|
||||
|
||||
'OnIdle'
|
||||
{
|
||||
$UserTrigger = "schtasks /Create /SC ONIDLE /I 1 /TN Updater /TR "
|
||||
|
|
|
|||
Loading…
Reference in New Issue