Created
June 20, 2014 18:33
-
-
Save justincjahn/784decc3ec337ceafe94 to your computer and use it in GitHub Desktop.
Export SCSM Incidents including analyst and affected user names.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module SMLets | |
$IRClass = Get-SCSMClass -Name System.WorkItem.Incident | |
$ASClass = Get-SCSMRelationshipClass -Name System.WorkItemAssignedToUser$ | |
$AFClass = Get-SCSMRelationshipClass -Name System.WorkItemAffectedUser$ | |
$IR = Get-SCSMObject -Class $IRClass | Select -Property ` | |
@{Label="Queue";Expression={$_.TierQueue.displayname}}, ` | |
Id, ` | |
Title, ` | |
@{Label="AffectedUser";Expression={(Get-SCSMRelatedObject -SMObject $_ -Relationship $AFClass).DisplayName}}, ` | |
@{Label="Source";Expression={$_.Source.displayname}}, ` | |
Description, ` | |
Priority, ` | |
@{Label="Impact";Expression={$_.Impact.displayname}}, ` | |
@{Label="Urgency";Expression={$_.Urgency.displayname}}, ` | |
@{Label="Classification";Expression={$_.Classification.displayname}}, ` | |
@{Label="AssignedToUser";Expression={(Get-SCSMRelatedObject -SMObject $_ -Relationship $ASClass).DisplayName}}, ` | |
CreatedDate, ` | |
FirstAssignedDate, ` | |
FirstResponseDate, ` | |
@{Label="Status";Expression={$_.Status.displayname}}, ` | |
@{Label="ResolutionCategory";Expression={$_.ResolutionCategory.displayname}}, ` | |
ResolvedDate, ` | |
ResolutionDescription | |
$IR | Export-CSV -NoTypeInformation -Path 'C:\Users\justinjahn\Documents\incidents.csv' -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment