-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.json
More file actions
143 lines (143 loc) · 8.37 KB
/
Example.json
File metadata and controls
143 lines (143 loc) · 8.37 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
{
"MaxConcurrentTasks": 6,
"Tasks": [
{
"TaskName": "Mirror finance folder",
"ComputerName": null,
"Robocopy": {
"InputFile": null,
"Arguments": {
"Source": "\\\\contoso\\finance results",
"Destination": "\\\\contoso\\reports",
"Files": [],
"Switches": [
"/MIR",
"/Z",
"/R:3",
"/W:10",
"/NP",
"/MT:16",
"/SECFIX",
"/COPYALL"
]
}
}
},
{
"TaskName": "Archive production files",
"ComputerName": "PC1",
"Robocopy": {
"InputFile": null,
"Arguments": {
"Source": "C:\\production",
"Destination": "C:\\archive",
"Files": ["*.log", "*.txt"],
"Switches": ["/MOVE", "/MINAGE:14"]
}
}
},
{
"TaskName": "Copy SAP file",
"ComputerName": null,
"Robocopy": {
"InputFile": "C:\\robocopyConfig..RCJ",
"Arguments": {}
}
}
],
"PSSessionConfiguration": "PowerShell.7",
"Settings": {
"ScriptName": "Move file over SFTP",
"SendMail": {
"When": "OnError",
"From": "ENV:SCRIPT_ADMIN_EMAIL_ADDRESS",
"FromDisplayName": "",
"To": ["007@example.com"],
"Bcc": [],
"Subject": "",
"Body": "<p>The script does action xxx.</p>",
"Smtp": {
"ServerName": "ENV:SMTP_SERVER",
"Port": 587,
"ConnectionType": "StartTls",
"UserName": "ENV:SMTP_USERNAME",
"Password": "ENV:SMTP_PASSWORD"
},
"AssemblyPath": {
"MailKit": "C:\\Program Files\\PackageManagement\\NuGet\\Packages\\MailKit.4.11.0\\lib\\net8.0\\MailKit.dll",
"MimeKit": "C:\\Program Files\\PackageManagement\\NuGet\\Packages\\MimeKit.4.11.0\\lib\\net8.0\\MimeKit.dll"
}
},
"SaveLogFiles": {
"What": {
"SystemErrors": true,
"RobocopyLogs": true
},
"Where": {
"Folder": "..\\Logs"
},
"DeleteLogsAfterDays": 30
},
"SaveInEventLog": {
"Save": false,
"LogName": "HCScripts"
}
},
"?": {
"MaxConcurrentTasks": "(Mandatory) Maximum number of 'Tasks' to run in parallel. Possible values: 1 - Run one task at a time; 5 - Run 5 tasks in parallel; ...",
"Tasks": [
{
"TaskName": "(Optional) A unique name for the task. This name will appear in email notifications and log files. If omitted the name of the destination folder will be used instead.",
"ComputerName": "(Optional) The name of the computer where the Robocopy command will run. Defaults to the local system if omitted. Example: 'SERVER1' for a remote server.",
"Robocopy": {
"InputFile": "(Optional) The path to a Robocopy configuration file. This can be useful to construct complex arguments.",
"Arguments": {
"Source": "(Mandatory) The source directory for the Robocopy operation.",
"Destination": "(Mandatory) The destination directory for the Robocopy operation.",
"Files": "(Optional) An array of file specifications to include in the robocopy operation, such as 'image.png' or '*.jpg'. If no value is provided, all files are included. For exclusion, use the /XF or /XD switches in the Switches parameter. Refer to Robocopy documentation for valid patterns.",
"Switches": "(Mandatory) An array of robocopy switches to control the robocopy operation. Each switch should be a separate string element in the array. Example: @('/MIR', '/Z', '/R:3', '/W:10'). Consult Robocopy documentation for a complete list of available switches."
}
}
}
],
"PSSessionConfiguration": "(Optional) The PowerShell version of the remote endpoint. This value corresponds to the output of the Get-PSSessionConfiguration cmdlet. The minimum supported version is 'PowerShell.7'. Defaults to 'PowerShell.7' if not specified.",
"Settings": {
"ScriptName": "(Mandatory) Name of the script, used in the log files and in the event logs.",
"SendMail": {
"When": "(Mandatory) Specifies when to send an email notification. Possible values: 'OnError' - Send email only when a system error or an action error occurs; 'OnErrorOrAction' - Send email when the script performed actions or when errors occurred; 'Always' - Send email when the script is finished, regardless of success or failure; 'Never' - Do not send email.",
"From": "(Mandatory) The sender's email address. Supports environment variables (e.g., 'ENV:MAIL_FROM_ADDRESS').",
"FromDisplayName": "(Optional) The display name to show for the sender. Email clients may display this differently. It is most likely to be shown if the sender's email address is not recognized (e.g., not in the address book). Supports environment variables (e.g., 'ENV:MAIL_FROM_DISPLAY_NAME').",
"To": "(Mandatory 'To' or 'Bcc') An array of recipient email addresses. The script will send an email to all addresses in the array.",
"Bcc": "(Mandatory 'To' or 'Bcc') An array of BCC email addresses.",
"Subject": "(Optional) The subject line of the email. Default value: 'N actions, N errors'",
"Body": "(Optional) The HTML body of the email. Default value: A summary table with action and error count.",
"Smtp": {
"ServerName": "(Mandatory) The hostname or IP address of the SMTP server. Supports environment variables (e.g., 'ENV:SMTP_SERVER').",
"Port": "(Mandatory) The port number of the SMTP server. Possible values: 25, 465, 587, 2525. Supports environment variables (e.g., 'ENV:SMTP_PORT').",
"ConnectionType": "(Optional) The connection type for the SMTP server. Possible values: 'None' - No encryption; 'Auto' - Attempt TLS, fall back to unencrypted; 'SslOnConnect' - Use SSL from the beginning; 'StartTls' - Start with unencrypted, then upgrade to TLS; 'StartTlsWhenAvailable' - Start with unencrypted, upgrade to TLS if supported. Default value: 'None'. Supports environment variables (e.g., 'ENV:SMTP_CONNECTION_TYPE').",
"UserName": "(Optional) The username for authenticating with the SMTP server. If undefined or NULL, no authentication is attempted. Supports environment variables (e.g., 'ENV:SMTP_USERNAME').",
"Password": "(Optional) The password for authenticating with the SMTP server. If undefined or NULL, no authentication is attempted. Supports environment variables (e.g., 'ENV:SMTP_PASSWORD')."
},
"AssemblyPath": {
"?": "To use email functionality, install the following packages: 'Install-Package -Name 'MailKit' -Source 'https://www.nuget.org/api/v2' -Scope 'AllUsers' -SkipDependencies' and 'Install-Package -Name 'MimeKit' -Source 'https://www.nuget.org/api/v2' -Scope 'AllUsers' -SkipDependencies'",
"MailKit": "(Mandatory) Path to the MailKit.dll assembly. Supports environment variables (e.g., 'ENV:MAILKIT_ASSEMBLY').",
"MimeKit": "(Mandatory) Path to the MimeKit.dll assembly. Supports environment variables (e.g., 'ENV:MIMEKIT_ASSEMBLY')."
}
},
"SaveLogFiles": {
"What": {
"SystemErrors": "(Mandatory) Whether to log execution errors, incorrect input file errors, etc. Possible values: true or false.",
"RobocopyLogs": "(Mandatory) Whether to create robocopy log files. Possible values: true or false."
},
"Where": {
"Folder": "(Mandatory) The path to the folder where log files will be created. Value '..\\Logs': Path relative to the script. Value 'C:\\MyApp\\Logs': An absolute path. If not specified or NULL, no log files will be created. Supports environment variables (e.g., 'ENV:LOG_FOLDER')."
},
"DeleteLogsAfterDays": "(Optional) The number of days to keep log files. Log files older than this value (based on their last write time) will be removed from the log folder specified in 'SaveLogFiles.Where.Folder'. If not specified or 0, logs will be kept indefinitely. CAUTION: Ensure the 'SaveLogFiles.Where.Folder' is specifically designated for log files to avoid unintended deletion of other files."
},
"SaveInEventLog": {
"Save": "(Mandatory) Whether to log messages to the Windows event log. Possible values: true or false.",
"LogName": "(Mandatory) The name of the event log to write to (e.g., 'Application', 'System', or a custom log name like 'Scripts'). Supports environment variables (e.g., 'ENV:EVENT_LOG_NAME')."
}
}
}
}