PowerShellservicenow

Download servicenow Incident attachment using PowerShell

Of late I received a request to share a PowerShell script to download attachment(s) from the given servicenow incident. Two attachments are available for the sample incident INC0010008 below is the illustration.

First we need to query incident by number to retrieve sys_id and through which we get the attachment metadata. Table name incident and table_sys_id are used respectively.

Here is the full code (Change the incident number and credentials)

Output is showed below!

Wait! We haven’t downloaded the file right? Here it is!

Enjoy PowerShell! Here is the reference link for documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *