Retrieving file attachment from an Incident via PowerShell

jansi rani krishnan 601 Reputation points
2021-07-07T08:35:26.047+00:00

Hi Team,

I am working on an integration project, which has a requirement to send file attached to an incident from ITSSP to ServiceNow.

Is there a way to retrieve the File(s) associated with the Incident via PowerShell ?

Regards,
Jansi

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
209 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,364 questions
{count} votes

Accepted answer
  1. Andreas Baumgarten 96,441 Reputation points MVP
    2021-07-07T10:20:27.027+00:00

    Hi @jansi rani krishnan ,

    there is a solution provided by Patrik Sundqvist for this:

    http://blogs.litware.se/?p=1369

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


1 additional answer

Sort by: Most helpful
  1. Andreas Baumgarten 96,441 Reputation points MVP
    2021-07-22T18:10:52.613+00:00

    Hi @jansi rani krishnan ,

    you can use these two values as it is in the script. Each value is the ID of a relationship

    $WIhasAttachMent = "aa8c26dc-3a12-5f88-d9c7-753e5a8a55b4" ``= RealtionshipClass = WorkItem has Attachment $CIhasAttachMent = "095ebf2a-ee83-b956-7176-ab09eded6784" = RealtionshipClass =ConfigItem has Attachment`

    Don't worry about getting the right relationship class with Get-SCSMRelationshipClass. The Ids should be the same in every SCSM environment and SCSM version.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten