Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft System Center Powershell Essentials

You're reading from   Microsoft System Center Powershell Essentials Efficiently administer, automate, and manage System Center environments using Windows PowerShell

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781784397142
Length 140 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Preface 1. Setting up the Environment to Use PowerShell 2. Administration of Configuration Manager through PowerShell FREE CHAPTER 3. Scenario-based Scripting for SCCM Administration 4. Administration of Operations Manager through PowerShell 5. Scenario-based Scripting for SCOM Administration 6. Administration of Service Manager through PowerShell 7. Scenario-based Scripting for SCSM Administration 8. Best Practices Index

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime