Last active
January 2, 2016 02:19
-
-
Save BenNeise/8236374 to your computer and use it in GitHub Desktop.
Lists open calls in SCSM 2012 using only native CMDlets (no SMLets)
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 the SCSM Native CMDLets | |
Import-Module "C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\System.Center.Service.Manager.psd1" | |
# Name of your SCSM Server | |
$strSCSMServer = "YourSCSMServer" | |
New-SCSMManagementGroupConnection -ComputerName $strSCSMServer | |
$objRelationshipAssignedToUser = Get-SCSMRelationship -Name "System.WorkItemAssignedToUser" | |
$objRelationshipAffectedUser = Get-SCSMRelationship -Name "System.WorkItemAffectedUser" | |
# Get an object containing all open incidents | |
$objIncidentsOpen = (Get-SCClassInstance -Class (Get-SCClass -Name "System.WorkItem.Incident")) | Where-Object { | |
$_.Status.ToString() -ne "IncidentStatusEnum.Closed" -and $_.Status.ToString() -ne "IncidentStatusEnum.Resolved" | |
} | |
# Format the object with calculated properties to display the required information | |
$objIncidentsOpen | Select-Object ` | |
Id, | |
Title, | |
@{Name="Source";Expression={$_.Source.DisplayName}}, | |
CreatedDate, | |
Priority, | |
@{Name="Affected User";Expression={$_.GetRelatedObjectsWhereSource($objRelationshipAffectedUser)}}, | |
@{Name="Status";Expression={$_.Status.DisplayName}}, | |
@{Name="SupportGroup";Expression={$_.TierQueue.DisplayName}}, | |
@{Name="Assigned To";Expression={$_.GetRelatedObjectsWhereSource($objRelationshipAssignedToUser)}} | |
# End of script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment