Changing the status of a service request
If you need to change the status of a service request in Service Manager 2012, you can do this with PowerShell. The following is an example:
Before running the PowerShell commands, install SMlets and import the module in the PowerShell prompt by running the following line:
Import-Module SMLets
The next thing to do is to get the appropriate class so that we can create an object from it. Use the following line to capture the service request class:
$Class = Get-SCSMClass -Name System.WorkItem.ServiceRequest
Other classes that can be used based on the requirement are as follows:
System.workitem.ChangeRequest System.workitem.Incident System.workitem.Problem System.workitem.ReleaseRecord
Now it is time to create a class object from the class that was captured in the previous step:
Get-SCSMObject -Class $Class -filter "Id -eq SR10" | Set-SCSMObject -Property Status -Value InProgress
Other status values that can be used are Closed
, Completed
, Cancelled
, Failed...