Need help in PowerShell code to update Incident form using SMLets

jansi rani krishnan 601 Reputation points
2021-06-16T17:39:45.797+00:00

Hi Team,

I tried the below code to retrieve the comment logged by the Analyst.

$IC=get-SCSMClass -Name System.workitem.Incident$
$IO=get-SCSMObject -class $C -filter "Id -eq IR5241"
$AnalystComment=get-SCSMRelationshipClass -Name System.workitem.TroubleTicketHasAnalystComment$
$CommentLog=(Get-SCSMRelatedObject -SMObject $IO -Relationship $AnalystComment).Comment

I need some help in writing PowerShell code to update the Analyst Comments in the Incident form using Set-SCSMObject SMLets.

Appreciate your help!!!

Regards,
Jansi

106312-image.png

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
211 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,440 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 101K Reputation points MVP
    2021-06-16T17:46:14.003+00:00

    Hi @jansi rani krishnan ,

    maybe this helps to get started:
    https://social.technet.microsoft.com/Forums/en-US/1a9ee91c-bcf7-43fd-95c1-389ddd8f6fb8/adding-nonprivate-comments-to-incidents-via-powershell?forum=administration
    With the script in the marked answer it should be possible to add an analyst comment.

    If you don't like to use a function you could use this:
    https://github.com/abaumgarten42/SCSM_Useful_PSscripts/blob/main/Add-IRanalystComment.ps1

    ----------

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

    Regards
    Andreas Baumgarten


0 additional answers

Sort by: Most helpful