Service Manager – get-SCSMServiceRequest

Service Manager – get-SCSMServiceRequest

Service Manager – get-SCSMServiceRequest

(fromĀ http://down-to-earth3.rssing.com/chan-2848486/all_p11.html)

Import-Module smlets

#Get Date 12 hours ago
$Date12HoursAgo = (Get-Date).AddHours(-400)

#Get Assigned To relationship class
$RelAssignedTo = Get-SCSMRelationshipClass -Name system.workitemAssignedTo

#Get Service Request Class
$srClass = Get-SCSMClass -Name system.workitem.servicerequest$

#Get all SRs made from 12 hours ago to now.
$SRs = Get-SCSMObject -Class $srClass -Filter “CreatedDate -gt $Date12HoursAgo”
“No Assigned User on the following Service Requests:`n`n”
foreach ($SR in $SRs)
{

if(!(Get-SCSMRelatedObject -SMObject $SR -Relationship $RelAssignedTo))
{
$SR | ft Displayname, CreatedDate -HideTableHeaders
}
}

Comments are closed.