Dealing with Review Activities, Dynamic Approvers and a Static Approver Count


When I am dealing with Review Activities in Service Manager I always use Orchestrator to populate the reviewers.  I try to hard code as little as possible into the templates so I have to maintain as little as possible.  One requirement that I was given for a change management project I worked on was to use an AD group that would contain CAB voting members and use that group to populate the CAB review activity.  One caveat to that was, no matter how big the AD group got, only 3 approvers where needed.  The problem is, a review activity sets the approval threshold by percentage.  If we had 10 possible CAB voters then I could set the threshold to 30% but if we added an additional 2 or 3 users to that group then 30% would no longer work and I’m not going to babysit that template as people come and go.  

Here is a simple PowerShell script that I use to dynamically calculate the percentage threshold so the required approvers will always be 3.  The $Results variable is then used to update the review activity in the Approval Percentage field.

$Results = Invoke-Command -ComputerName localhost -ScriptBlock {$CAB = (Get-ADGroup SG-SCSM-CAB-MEMBERS -Properties *).member.count
$value = 3/$CAB*100
[System.Math]::Truncate($value)}

There, no more babysitting that!

Advertisements

One thought on “Dealing with Review Activities, Dynamic Approvers and a Static Approver Count

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s