-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathNew-PSUSchedule.txt
More file actions
452 lines (340 loc) · 19.5 KB
/
New-PSUSchedule.txt
File metadata and controls
452 lines (340 loc) · 19.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
NAME
New-PSUSchedule
SYNOPSIS
Creates a new schedule within PSU.
SYNTAX
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] -Continuous [-Credential <Variable>] [-Delay <TimeSpan>] [-DelayHour <Int32>] [-DelayMinute <Int32>] [-DelaySecond <Int32>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-Cron] <String> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-OneTime <DateTime>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] -Day <String[]> -DayOfWeek [-Hour <Int32>] [-Minute <Int32>] [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] -DayOfMonth <Int32> -EveryMonth [-Hour <Int32>] [-Minute <Int32>] [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] -DayOfMonth <Int32> [-Hour <Int32>] [-Minute <Int32>] -Month <String[]> -SpecificMonth [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] -EveryDay [-Hour <Int32>] [-Minute <Int32>] [-Folder <String>] [<CommonParameters>]
New-PSUSchedule [-Script] <Script> [-AppToken <String>] [-ComputerName <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Description <String>] [-Name <String>] [-UseDefaultCredentials] [-Condition <ScriptBlock>] [-Integrated] [-Paused] [-Timeout <Int32>] [-RandomDelay] [-AvailableInBranch <String[]>] [-Computer <String>] [-Parameters <Hashtable>] [-RandomDelayMaximum <Int32>] [-TrustCertificate] -EveryHour [-Minute <Int32>] [-Folder <String>] [<CommonParameters>]
DESCRIPTION
Creates a new schedule within PSU. Schedules allow you to automate when jobs run and run jobs continuously.
PARAMETERS
-AppToken <String>
An app token to access the PSU API.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ComputerName <String>
The HTTP address of the PSU REST API server.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases Uri
Accept wildcard characters? false
-Continuous [<SwitchParameter>]
Runs a job continously with an optional delay between executions.
Required? true
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Credential <Variable>
A credential for the user to run the job as. Use New-UACredential to create this credential object.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Cron <String>
The CRON schedule to use for this schedule.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Delay <TimeSpan>
The delay inbetween continous job executions.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DelayHour <Int32>
The delay in hours inbetween continous job executions.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DelayMinute <Int32>
The delay in minutes inbetween continous job executions.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DelaySecond <Int32>
The delay in seconds inbetween continous job executions.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Script <Script>
The script to schedule. Use Get-UAScript to retrieve a script object.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByValue)
Aliases none
Accept wildcard characters? false
-TimeZone <String>
The TimeZone to execute the script in. By default, it runs in the current user's time zone.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Environment <String>
The name of the environment to run the script within.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-OneTime <DateTime>
Schedules at a time in the future. The initial time zone is determined by the Kind property of the DateTime object. It the kind is Unknown, it will be assumed to be UTC.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Description <String>
Description for the schedule.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Name <String>
Name of the schedule to display in the admin console.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-UseDefaultCredentials [<SwitchParameter>]
Use default credentials when connecting to the management API
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Condition <ScriptBlock>
A script block that determines whether this schedule should execute. This script block should return $true or $false.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Integrated [<SwitchParameter>]
Executes the command internally rather than using the Management API. Only works when running script from within PowerShell Universal.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Paused [<SwitchParameter>]
Whether this schedule is paused.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Timeout <Int32>
The timeout in minutes for this schedule.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-RandomDelay [<SwitchParameter>]
A random delay will be applied to when this script is started. The random delay will be between 0 and 60 seconds.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-AvailableInBranch <String[]>
Branches that this schedule will run in.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Computer <String>
Computer or computer group that will run this schedule.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Parameters <Hashtable>
A hashtable of parameters for this schedule to pass to the target script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-RandomDelayMaximum <Int32>
The maximum number of seconds to delay.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-TrustCertificate [<SwitchParameter>]
Whether the cmdlet should ignore certificate issues.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Day <String[]>
The day of the week to run the script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DayOfMonth <Int32>
The day of the month to run the script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DayOfWeek [<SwitchParameter>]
The day of the week to run the script.
Required? true
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-EveryDay [<SwitchParameter>]
Whether to run the script every day.
Required? true
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-EveryHour [<SwitchParameter>]
Whether to run the script every hour.
Required? true
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-EveryMonth [<SwitchParameter>]
Whether to run the script every month.
Required? true
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Hour <Int32>
The hour to run the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Minute <Int32>
The minute to run the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Month <String[]>
The months to run the script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-SpecificMonth [<SwitchParameter>]
Whether to run the script in specific months.
Required? true
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Folder <String>
The folder in which to store this schedule. This is for visual use only.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
UniversalAutomation.Script
OUTPUTS
System.Object
NOTES
-------------------------- Example 1 --------------------------
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> New-PSUSchedule -Script $Script -Cron '*/5 * * * *'
Creates a new schedule that runs every five minutes.
-------------------------- Example 2 --------------------------
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> New-PSUSchedule -Script $Script -Cron '*/5 * * * *' -Credential $Secret:Credential
Creates a new schedule that runs every five minutes as 'adam'.
-------------------------- Example 3 --------------------------
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> New-PSUSchedule -Script $Script -Continous -DelayMinute 5
Creates a schedule that runs continuously. It will start a new job once the previous one finishes with a delay of 5 minutes inbetween executions.
-------------------------- Example 4 --------------------------
PS C:\> $Script = Get-PSUScript -Name 'Script1.ps1'
PS C:\> $Time = (Get-Date).AddMinutes(30).ToUniversalTime()
PS C:\> New-PSUSchedule -Script $Script -OneTime $Time -TimeZone "America/Phoenix"
Creates a schedule that runs once in 30 minutes in the 'America/Phoenix' time zone.
RELATED LINKS