Hi @jansi rani krishnan ,
please try this to get the analyst comments of an incident:
Import-module SMlets # Import SMLets module
$smdefaultserver = "SCSM1" # Define SCSM Management Server
$IRid = "IR2031" # Define Incident Record
$IRclass=Get-SCSMclass -name System.Workitem.Incident$ # Get SCSM Incident class object
$IRobject=Get-SCSMobject -class $IRclass -filter "ID -eq $IRid" # Get IR object
# Get analyst comments of Incident
$relIncidentAnalystComment = Get-SCSMRelationshipClass -Name System.WorkItem.TroubleTicketHasAnalystComment$
$AnalystComments = Get-SCSMRelatedObject -SMObject $IRobject -Relationship $relIncidentAnalystComment
$AnalystComments | Select *
If you need the user comments and/or the action log entries as well, this might help:
https://github.com/abaumgarten42/SCSM_Useful_PSscripts/blob/main/Get-IncidentComments.ps1
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten