Hello,
You will need to update the following lines:
$departmentProperty = "department"
Replace department with the LDAP name of the property that will be used for the group names template.
$groupNameTemplate = "Department_{0}_"
Replace Department_{0}_ with the required template for group names.
Also you can update warnings depending on the property used for the group names template. For example:
Replace There is no group for department '$department' with There is no group for Job Code '$department'.