-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathNew-PSUScript.txt
More file actions
408 lines (309 loc) · 16.6 KB
/
New-PSUScript.txt
File metadata and controls
408 lines (309 loc) · 16.6 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
NAME
New-PSUScript
SYNOPSIS
Creates a new script within PowerShell Universal.
SYNTAX
New-PSUScript [-AppToken <String>] [-ComputerName <String>] [-Description <String>] [-DisableManualInvocation] [-ManualTime <Int32>] [-MaxHistory <Int32>] -Name <String> [-Notes <String>] [-Parameter <ScriptParameter[]>] [-Path <String>] -ScriptBlock <ScriptBlock> [-Status {Draft | Pending_Review | Published | Disabled}] [-Tag <Tag[]>] [-ConcurrentJobs <Int32>] [-Environment <String>] [-TimeOut <Double>] [-Credential <Variable>] [-UseDefaultCredentials] [-Integrated] [-RetryLimit <Int32>] [-DiscardPipeline] [-LoadProfile] [-WorkingDirectory <String>] [-Role <String[]>] [-AvailableInBranch <String[]>] [-PortalOutputType <PortalOutputType>] [-TrustCertificate] [-PortalOpenInNewWindow] [-Icon <String>] [-DisplayOutputOnExecute] [-PortalBehavior <ScriptPortalBehavior>] [-PortalLeaveForm] [<CommonParameters>]
New-PSUScript [-AppToken <String>] [-ComputerName <String>] [-Description <String>] [-DisableManualInvocation] [-ManualTime <Int32>] [-MaxHistory <Int32>] -Name <String> [-Notes <String>] [-Parameter <ScriptParameter[]>] -Path <String> [-Status {Draft | Pending_Review | Published | Disabled}] [-Tag <Tag[]>] [-ConcurrentJobs <Int32>] [-Environment <String>] [-TimeOut <Double>] [-Credential <Variable>] [-UseDefaultCredentials] [-Integrated] [-RetryLimit <Int32>] [-DiscardPipeline] [-LoadProfile] [-WorkingDirectory <String>] [-Role <String[]>] [-AvailableInBranch <String[]>] [-PortalOutputType <PortalOutputType>] [-TrustCertificate] [-PortalOpenInNewWindow] [-Icon <String>] [-DisplayOutputOnExecute] [-PortalBehavior <ScriptPortalBehavior>] [-PortalLeaveForm] [<CommonParameters>]
New-PSUScript [-AppToken <String>] [-ComputerName <String>] [-Description <String>] [-DisableManualInvocation] [-ManualTime <Int32>] [-MaxHistory <Int32>] [-Notes <String>] [-Parameter <ScriptParameter[]>] [-Status {Draft | Pending_Review | Published | Disabled}] [-Tag <Tag[]>] [-ConcurrentJobs <Int32>] [-Environment <String>] [-TimeOut <Double>] [-Credential <Variable>] [-UseDefaultCredentials] [-Integrated] [-RetryLimit <Int32>] [-DiscardPipeline] [-LoadProfile] [-WorkingDirectory <String>] -Command <String> -Module <String> [-Role <String[]>] [-AvailableInBranch <String[]>] [-PortalOutputType <PortalOutputType>] [-TrustCertificate] [-PortalOpenInNewWindow] [-Icon <String>] [-DisplayOutputOnExecute] [-PortalBehavior <ScriptPortalBehavior>] [-PortalLeaveForm] [<CommonParameters>]
DESCRIPTION
Creates a new script within PowerShell Universal. Scripts can be manually executed or scheduled inside PSU. Scripts created based on content will be written to the repository directory. Scripts created by path will be referenced by that path.
Script configurations are stored in .universal/scripts.ps1
You can also use this cmdlet to create scripts through the REST API.
PARAMETERS
-AppToken <String>
The AppToken that is used for calling the PowerShell Universal Management API. You can also call Connect-PSUServer before calling this cmdlet to set the AppToken for the entire session.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ComputerName <String>
Specifies the computer name or URL that should be called when accessing the PowerShell Universal Management API. You can also use Connect-PSUServer before calling this cmdlet to set the computer name for the entire session.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases Uri
Accept wildcard characters? false
-Description <String>
The description of the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DisableManualInvocation [<SwitchParameter>]
Disables manual invocation of the script. The script can only be run on a schedule.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ManualTime <Int32>
The amount of time it would take to run this particular script manually.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-MaxHistory <Int32>
The maximum job history for this script. This defaults to 100.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Name <String>
The name of this script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Notes <String>
Notes to include with this script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Parameter <ScriptParameter[]>
Obsolete
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Path <String>
The path to the script. This can be a relative path to the repository directory or an absolute path.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
A script block to define for this script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Status <ScriptStatus>
Not used.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Tag <Tag[]>
Tags to assign to this script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ConcurrentJobs <Int32>
The number of concurrent jobs that are allowed for this script. By default, there is no limit.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Environment <String>
The environment to run this script within.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-TimeOut <Double>
The number of minutes before jobs based on this script will time out.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Credential <Variable>
The user credential variable to use when executing this script.
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
-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
-RetryLimit <Int32>
The number of times to retry this script if it fails.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DiscardPipeline [<SwitchParameter>]
Whether to discard pipeline output rather than persist it in the database.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-LoadProfile [<SwitchParameter>]
Loads the user profile when running this script as another user.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-WorkingDirectory <String>
The working directory of the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Command <String>
The command that defines this script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Module <String>
The module that contains the command that defines this script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Role <String[]>
The role that is required to execute this script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-AvailableInBranch <String[]>
When specified, this script will only be available in the specified branches.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-PortalOutputType <PortalOutputType>
The type of portal output to display when running this script in the portal.
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
-PortalOpenInNewWindow [<SwitchParameter>]
Whether to open this script in a new window when viewing it in the portal.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Icon <String>
An icon to display in the portal.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DisplayOutputOnExecute [<SwitchParameter>]
Displays output of the script while it is executing in the portal.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-PortalBehavior <ScriptPortalBehavior>
How this script behaves in the portal.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-PortalLeaveForm [<SwitchParameter>]
Whether to leave the script's form after executing it in the portal.
Required? false
Position? named
Default value False
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
None
OUTPUTS
System.Object
NOTES
-------------------------- Example 1 --------------------------
New-PSUScript -Name 'Script1.ps1' -Path 'Script1.ps1'
Creates a script within PSU that references a relative path of Script1.ps1 in the repository folder.
-------------------------- Example 2 --------------------------
New-PSUScript -Name 'Script1.ps1' -ScriptBlock {
"Hello, world!"
}
Creates a script within PSU based on the script block provided. This will create a Script1.ps1 file within the repository directory.
RELATED LINKS
Get-PSUScript
Remove-PSUScript
Invoke-PSUScript
Set-PSUScript
Get-PSUEnvironment