Skip to content

Creating and Configuring Scripts

rderewianko edited this page Jan 5, 2018 · 5 revisions

Basic Script Uploading

Place a script in the scripts directory and run ./sync.py --url https://your.jss.com:8443 --username git2jss_admin --password your_password_here --limit amount_of_connections_here. This will upload each script in the scripts directory to the JSS with the default name being the file name.

The only information that is updated when doing this is the script content, if the script already exists in the JSS and has other information populated such as parameters, info, etc... This information will be retained in the JSS unless a template has been created.

Supported Extensions

The following file extensions will be treated as scripts, any other file types in the script directory will be ignored.

.sh, .py, .pl, .swift

Script Uploading with Templates

Templates are a special way of populating additional data in the JSS, this allows us to specify things like parameters or information in our git repo and have it uploaded to JSS.

An example can be found in scripts/templates/sample_script.xml, each template must have the same basename of the script - for example we cannot have sample_script.py and sample_script.sh as scripts because sync.py will not be able to determine which one it should use. (this may be resolved in a future update by specifying the full script name and appending .xml ex - sample_script.py.xml)

Template Example

<script>
	<name>Apply Software Updates</name>
	<category>Scripts</category>
	<info></info>
	<notes>Created By: Adam Furbee</notes>
	<priority>After</priority>
	<os_requirements/>
	<parameters>
		<parameter4></parameter4>
		<parameter5></parameter5>
		<parameter6></parameter6>
		<parameter7></parameter7>
		<parameter8></parameter8>
		<parameter9></parameter9>
		<parameter10></parameter10>
		<parameter11></parameter11>
	</parameters>
	<os_requirements/>
	<script_contents/>
</script>

The above template when named correctly will create a script name 'Apply Software Updates' in the jss, place it in the scripts category (note this category must already exist git2jss will fail if its not), and add a note as to who it was created by. Some of the other fields are left blank and this is fine, but I do want to point out if a template is used it is an all or nothing deal meaning if you have something populated in the jss but blank in the template it will now be blank in the JSS.

Important Notes

git2JSS will fail if you've put special characters in.

Name	Character	
quot	"	
amp	&	
apos	'	
lt	>
gt	>

As an example

Install & Update will fail

Install &amp; Update will not