How do I generate a passworded ZIP with a script?

Ohki_Yamamoto
Tera Guru

How do I generate a passworded ZIP with a script?

 

I copied the following zip.min.js script to Script include and tried to save it to generate a ZIP with password, but it failed to save with a JavaScript syntax error.

 

https://cdn.jsdelivr.net/npm/@zip.js/zip.js/dist/zip.min.js

 

Is there a better way?

 

(We are considering not using Integration hub's ZIP step or Utility Action Scope, as they are paid for.)

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Ohki_Yamamoto 

Within ServiceNow it's not possible even with ZIP Step. That step will just create a zip file but not password protected zip.

I have implemented this in the past and steps as below

1) setup mid server

2) use java library zip4j-2.10.0 and load to mid server

3) send the files to mid server along with password you want

4) once all the files are sent, mid server script include will create password protected zip and will attach it to some record of ServiceNow using REST API call

I cannot share the script though but I hope with these steps you should be able to handle the requirement.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Omkar Mone
Mega Sage

Creating a password-protected ZIP file directly in ServiceNow isn’t possible natively. However, you can leverage a MID Server and a MID Server script (e.g., PowerShell) to handle this functionality for you.

Ankur Bawiskar
Tera Patron
Tera Patron

@Ohki_Yamamoto 

Within ServiceNow it's not possible even with ZIP Step. That step will just create a zip file but not password protected zip.

I have implemented this in the past and steps as below

1) setup mid server

2) use java library zip4j-2.10.0 and load to mid server

3) send the files to mid server along with password you want

4) once all the files are sent, mid server script include will create password protected zip and will attach it to some record of ServiceNow using REST API call

I cannot share the script though but I hope with these steps you should be able to handle the requirement.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ohki_Yamamoto 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ohki_Yamamoto1
Tera Contributor

Thank you very much. It was very helpful!