Log in  \/ 
x
x
x
Register  \/ 
x

19
May
2014

How to get a user that marked a manual activity as completed in SCSM

Last week one of our customers asked how to get a person who actually completed a manual activity. After some investigation, I’ve realized that the only source of that information is a history log of the manual activity.

It is a luck that SMlets has a commandlet named Get-SCSMObjectHistory. After some testing, I finished with this code:

import-module smlets 

# set ID for a manual activity

$MA_Id="MA235" 

# get the manual activity

$MA Get-SCSMObject-class (Get-SCSMClass-name System.WorkItem.Activity.ManualActivity) -filter "Id -eq $MA_Id" 

#get-history

$h Get-SCSMObjectHistory -Object $MA 

# get a user name that completed MA

foreach ($case in $h.history.GetEnumerator()) {foreach ($change in $case.changes where-object {$_.newvalue -like "ActivityStatusEnum.Completed"}) {$case.UserName}}

Categories: System Center 2012, System Center 2012 Service Manager, SCUTILS BLOG

Marat Kuanyshev

Leave a comment

You are commenting as guest.

This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.