how can I set Affected Item for incident?

May 27, 2011 at 12:41 PM

I need automaticalli add computer name to Affected Item field in incident form.

How can I do it?

May 27, 2011 at 8:26 PM

I'm not sure I understand what you're looking for. Do you want to do this via script or the UI?

May 27, 2011 at 8:32 PM
Edited May 27, 2011 at 8:33 PM

I use SMLets to automate creating Incident in my organization with custom application (based on this cmdlets for SCSM)

I need add computer info to incident via script -> in UI computer information in incident stored in Affected Item field

May 27, 2011 at 11:04 PM

Essentially, you need the System.WorkItemAboutConfigItem relationship and the incident computer you want to add. After you have those three things, you can create the relationship and you'll be done!

Here's an example: 

$incident     = get-scsmclass m.incident$ |get-scsmobject -filter "DisplayName -eq 'CustomIR194'"
$computer     = get-scsmclass Microsoft.Windows.Computer$|get-scsmobject -filter "PrincipalName -eq ''"
$relationship = Get-SCSMRelationshipClass -name System.WorkItemAboutConfigItem
New-SCSMRelationshipObject -Relationship $relationship -Source $incident -Target $computer -bulk

after you run this script, the computer should be present (you'll have to find your own incident and computer, of course). You can do this for any number of computers/incidents


May 31, 2011 at 1:13 PM

yes! Its work! Thanks!

may be needed to create a section "Quick Start"....