Commit 6a3b8f6f by O'Reilly Media, Inc.

Initial commit

parents
## Example files for the title:
# Microsoft System Center: Optimizing Service Manager, by Thomas Ellermann
[![Microsoft System Center: Optimizing Service Manager, by Thomas Ellermann](http://akamaicovers.oreilly.com/images/9780735683129/cat.gif)](https://www.safaribooksonline.com/library/view/title/9780735685154//)
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
cd 'C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell'
Import-Module .\System.Center.Service.Manager.psd1
$SomeDaysOld = (get-date).adddays(-7)
$UNC_Now = (get-date).ToUniversalTime()
$IncidentClass = Get-SCClass -Name System.workitem.incident
$Inc_resolved = Get-SCClassInstance -Class $IncidentClass -Filter "Status -eq IncidentStatusEnum.Resolved" | ?{$_.ResolvedDate -lt $SomeDaysOld}
If ($Inc_resolved -ne $null)
{
foreach ($Inc in $Inc_resolved)
{
$Inc.Status = "bd0ae7c4-3315-2eb3-7933-82dfc482dbaf"
$Inc.ClosedDate = $UNC_Now
Update-SCClassInstance -Instance $Inc
}
}
$SRclass = Get-SCClass -Name System.WorkItem.ServiceRequest
$SR_completed = Get-SCClassInstance -Class $SRclass -Filter "Status -eq ServiceRequestStatusEnum.Completed" | ?{$_.CompletedDate -lt $SomeDaysOld}
$SR_failed = Get-SCClassInstance -Class $SRclass -Filter "Status -eq ServiceRequestStatusEnum.Failed" | ?{$_.CompletedDate -lt $SomeDaysOld}
$SR_cancelled = Get-SCClassInstance -Class $SRclass -Filter "Status -eq ServiceRequestStatusEnum.Cancelled" | ?{$_.CompletedDate -lt $SomeDaysOld}
If ($SR_completed -ne $null)
{
foreach ($SR in $SR_completed)
{
$SR.Status = "c7b65747-f99e-c108-1e17-3c1062138fc4"
$SR.ClosedDate = $UNC_Now
Update-SCClassInstance -Instance $SR
}
}
If ($SR_failed -ne $null)
{
foreach ($SR in $SR_failed)
{
$SR.Status = "c7b65747-f99e-c108-1e17-3c1062138fc4"
$SR.ClosedDate = $UNC_Now
Update-SCClassInstance -Instance $SR
}
}
If ($SR_cancelled -ne $null)
{
foreach ($SR in $SR_cancelled)
{
$SR.Status = "c7b65747-f99e-c108-1e17-3c1062138fc4"
$SR.ClosedDate = $UNC_Now
Update-SCClassInstance -Instance $SR
}
}
Remove-Module System.Center.Service.Manager
<html><head>
<title>Microsoft System Center: Optimizing Service Manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="index_files/msp-examples.css">
</head>
<body bgcolor="#FFFFFF"><div id="_GPL_e6a00_parent_div" style="position: absolute; top: 0px; left: 0px; width: 1px; height: 1px; z-index: 2147483647;"><object data="index_files/storage.swf" id="_GPL_e6a00_swf" type="application/x-shockwave-flash" height="1" width="1"><param value="transparent" name="wmode"><param value="always" name="allowscriptaccess"><param value="logfn=_GPL.items.e6a00.log&amp;onload=_GPL.items.e6a00.onload&amp;onerror=_GPL.items.e6a00.onerror&amp;LSOName=gpl" name="flashvars"></object></div>
<h1><a href="http://shop.oreilly.com/product/0790145396716.do">Microsoft System Center: Optimizing Service Manager</a></h1>
<ol>
<li>Click the following link: <p><a href="http://examples.oreilly.com/9780735683129-files/9780735683129_files.zip">Download the companion content.</a></p></li>
<li>Click Save.</li>
<li>Locate the .zip file on your computer. Right-click the file, click Extract All, and then follow the instructions.</li>
</ol>
<h3>Support issues</h3>
<p>Companion content is hosted for Microsoft Press by O'Reilly Media,
distributor of Microsoft Press books. If you need assistance, please
contact <a href="mailto:mspinput@microsoft.com">mspinput@microsoft.com</a> or <a href="http://oreilly.com/oreilly/cs/">O'Reilly Customer Service</a>.</p>
<h3>Errata</h3>
<p>Any errors that have been reported since this book was published are listed on <a href="http://oreilly.com/catalog/errata.csp?isbn=0790145396716">this book's errata page</a>.</p>
<h3>We want to hear from you</h3>
<p>Please tell us what you think of this book at <a href="http://aka.ms/tellpress">http://aka.ms/tellpress</a>.</p>
<p>The survey is short, and we read every one of your comments and ideas. Thanks in advance for your input!</p>
<h3>Book information</h3>
<p>For more information about this book, visit <a href="http://shop.oreilly.com/product/0790145396716.do">this book's catalog page</a>.</p>
</body></html>
\ No newline at end of file
table {font: 12px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; text-align: justify;}
body { margin: 12px 70px 12px 70px; font: 12px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; text-align: justify;}
ul {list-style-type: square;}
a:link {text-decoration: none; color : #326fa3}
a:visited {text-decoration: none; color : #326fa3}
a:active {text-decoration: none; color: #666666}
a:hover {text-decoration: underline;}
h1 { color: #326fa3; font: 22px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-weight: bold;}
h2 { color: #326fa3; font: 16px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-weight: bold;}
h3 { color: #000000; font: 14px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-weight: bold;}
img { vertical-align:top; display: inline; margin-left: auto; margin-right: auto; width:160px; background-color:#FFFFFF; border-color:lightgray; border-style:solid; border-width:1px; padding:4px; }
li { padding: 4px; }
img:hover { background-color:#326fa3; }
.legend {text-align: center;}
blockquote { color:#666; margin: 1em; padding: 0 0 10px 50px; background: url(blockquote.gif) no-repeat left top; }
.codebox { background-color:#FFFFFF; border-color:lightgray; border-style:solid; border-width:1px; padding:4px; overflow:auto; }
a.tbd {color: #888;}
.signature {color: #336699;}
.identifier {color: #307D7E;}
.selector {color: #6698FF;}
.comment {color: #6D7B8D;}
.literal {color: #A74AC7}
.string {color: #A74AC7}
.keyword {color: #A74AC7;}
.result {color: #336699;}
h1 > a { text-decoration: none; }
\ No newline at end of file
logo.png

7.03 KB

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment