Last active
August 29, 2015 13:57
-
-
Save KirkMunro/9791294 to your computer and use it in GitHub Desktop.
A brief introduction to some of the capabilities provided by the ScsmPx module.
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
# Get all commands included in the ScsmPx module | |
Get-ScsmPxCommand | |
# Get all commands included in the SCSM native modules | |
Get-SCSMCommand |
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
# Get all raw System.WorkItem.Incident instances | |
Get-ScsmPxIncident |
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
# Get all incidents as displayed in the "All Incidents" view in the System | |
# Center Service Manager Management Console | |
Get-ScsmPxIncident -View All |
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
# Get all commands that can be used to manage incidents | |
Get-Command -Noun ScsmPxIncident |
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
# Look up the Resolved incident status enumeration | |
$resolved = Get-ScsmPxListItem -ListName IncidentStatusEnum -Name Resolved | |
# Look up the Closed incident status enumeration | |
$closed = Get-ScsmPxListItem -ListName IncidentStatusEnum -Name Closed | |
# Identify our search filters (resolved incidents at least 7 days old) | |
$filters = @( | |
"(Status -eq '$($resolved.Id)')" | |
"(LastModified -lt '$([System.DateTime]::UtcNow.AddDays(-7))')" | |
) | |
# Now get any matching incidents and change their status to closed | |
Get-ScsmPxIncident -Filter ($filters -join ' -and ') | | |
Set-ScsmPxIncident -Property @{ | |
Status = $closed | |
ClosedDate = [System.DateTime]::UtcNow | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment