Manual activity and service request check
This example demonstrates how to change the status of a manual activity or service request using PowerShell. The same example can be used to change the status of other activities or requests.
To perform this example, you need to download the external Service Manager module, SMlets
. We can leverage this module and easily change the status of a ticket for Service Manager. The following are the code statements that can be used to change the status of a manual activity and service request:
# Importing module Import-Module -Name smlets # Getting details of the manual activity $ManAct = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity) -Filter "ID -eq MA1234" # Changing the status of the manual activity Set-SCSMObject -SMObject $ManAct -Property Status -Value Completed # Getting the specific service request $SerReq = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest) -filter "ID -eq SR1234" ...