Hello Experts,
I have a need to modify specific incidents via PowerShell; specifically to add/remove a CI. Since the status is set to closed, I cannot reactivate the incident and change the fields via console due to legal requirements (I also cannot change it while it's closed because I have a form assembly preventing changes to closed incidents).
That being said I must modify them through PowerShell so I began writing a script to try it out. I have the variables I may or may not need for getting the correct relationship and CI class, I'm stuck at what the property should be in the property hash-table
and would appreciate any guidance.
Here is what I have so far:
$IncidentClass = Get-SCSMClass -Name System.WorkItem.Incident$
$CIclass = Get-SCSMclass -Name COMPANY.CI.Class$
$RelWIaboutCI = Get-SCSMRelationshipClass -Name System.WorkItemAboutConfigItem$
$CIToAdd = "Example CI"
$Incident = Get-SCSMObject -Class $IncidentClass -Filter "DisplayName -like '%IR41010%'"
$PropertyHashTable = @{"Affected Items" = $CIToAdd}
$AffectedCI = Set-SCSMObject -SMObject $Incident -PropertyHashtable


