2016/03/09

PowerShell/SCSM - Get Manual Activities Completed per Assigned user in the last month

I wanted to expend a bit on the previous post which retrieved all the Manual Activities completed in the last month.

I want to go a step further and get the top Users who closed the most Manual Activities in that period.


# Smlets Module
Import-module -name Smlets

# Get the Manual Activity Class
$MAClass = Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity$

# Get the Manual Activity Completed Status Enumeration
$MAStatusCompleted = Get-SCSMEnumeration -Name ActivityStatusEnum.Completed$

# Get the starting date from where we are searching
$MAModifiedDay = (Get-date).Adddays(-30)

# Get the Criteria Class
$CriteriaClass = "Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectCriteria"

# Define the Filter
$Filter = "Status = '$($MAStatusCompleted.Id)' AND LastModified > '$MAModifiedDay'"

# Create de Criteria Object
$CriteriaObject = new-object $CriteriaClass $Filter, $MAClass

# AssignedUser RelationshipClass
$RelationshipClass_AssignedUser = Get-SCSMRelationshipClass -Name System.WorkItemAssignedToUser$

# Search for Manual Activities, show the Ticket ID and the AssignedTo User's displayname
# Group per AssignedTo User and sort per Count
Get-SCSMObject -criteria $CriteriaObject|
    Select-Object -property Name, @{
        Label="AssignedTo";
        E={
            (Get-ScsmRelatedObject -SMObject $_ -Relationship $RelationshipClass_AssignedUser).displayname
        }
    }|
    Group-Object -Property AssignedTo |
    Sort-Object -Property Count -Descending



2016/03/08

PowerShell/SCSM - Get Manual Activities Completed in the last month

I got an interested question from a reader that asked how he could get all the Manual Activities completed in the last 30 days using one Filter.

I got some trouble working with Get-SCSMObject and multiple conditions in the -Filter parameter, but got it working using the Criteria parameter. Hope this help!


# Import Smlets Module
Import-module -name Smlets

# Get the Manual Activity Class
$MAClass = Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity$

# Get the Manual Activity Completed Status Enumeration
$MAStatusCompleted = Get-SCSMEnumeration -Name ActivityStatusEnum.Completed$

# Get the starting date from where we are searching
$MAModifiedDay = (Get-date).Adddays(-30)

# Get the Criteria Class
$CriteriaClass = "Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectCriteria"

# Define the Filter
$Filter = "Status = '$($MAStatusCompleted.Id)' AND LastModified > '$MAModifiedDay'"

# Create de Criteria Object
$CriteriaObject = new-object $CriteriaClass $Filter, $MAClass

# Search for Manual Activities
Get-SCSMObject -criteria $CriteriaObject

2016/02/24

Windows Management Framework (WMF) 5.0 RTM released (again)

Microsoft just re-released the new version of Windows Management Framework (WMF) 5.0 RTM for Windows Server 2012 R2, Windows Server 2012, Windows 2008 R2 SP1, Windows 8.1, and Windows 7 SP1.

The PowerShell Team previously released WMF 5.0 RTM two months ago but it was pulled-back mainly because of the $PSmodulePath issue.

Download WMF5


Changes in the republished packages

  • The KB numbers of these packages (KB3134758, KB3134759, and KB3134760) are different than previously released WMF 5.0 RTM packages (KB3094174, KB3094175, and KB3094176).
  • These packages have fixes only for the PSModulePath issue compared to the previously released WMF 5.0 RTM packages.

Uninstall previously released WMF 5.0 RTM packages

You must uninstall previously released WMF 5.0 RTM (KB3094174, KB3094175, and KB3094176) packages.


No impact to Windows 10 and Windows Server 2016 Technical Preview builds

Windows 10 and Windows Server 2016 Technical Previews builds are not impacted by the above mentioned PSModulePath issue. This issue was only impacting down-level systems where WMF 5.0 RTM can be installed.


To install WMF 5.0 by using Command Prompt

  1. After you have downloaded the correct package for your computer's architecture, open a Command Prompt window with elevated user rights (Run as Administrator). On the Server Core installation options of Windows Server 2012 R2 or Windows Server 2012 or Windows Server 2008 R2 SP1, Command Prompt opens with elevated user rights by default.
  2. Change directories to the folder into which you have downloaded or copied the WMF 5.0 installation package.
  3. Run one of the following commands.

    • On computers that are running Windows Server 2012 R2 or Windows 8.1 x64, run Win7AndW2K8R2-KB3134760-x64.msu /quiet
    • On computers that are running Windows Server 2012, run W2K12-KB3134759-x64.msu /quiet
    • On computers that are running Windows Server 2008 R2 SP1 or Windows 7 SP1 x64, run Win7AndW2K8R2-KB3134760-x64.msu /quiet
    • On computers that are running Windows 8.1 x86, run Win8.1-KB3134758-x86.msu /quiet
    • On computers that are running Windows 7 SP1 x86, run Win7-KB3134760-x86.msu /quiet

Overview of all scenarios enabled by WMF 5.0

  • New and updated cmdlets based on community feedback
  • Generate Windows PowerShell cmdlets based on an OData endpoint with ODataUtils
  • Manage .ZIP archives through new cmdlets
  • Interact with symbolic links using improved Item cmdlets
  • Network Switch management with Windows PowerShell
  • DSC authoring improvements in Windows PowerShell ISE
  • 32-bit support for the configuration keyword in DSC
  • Audit Windows PowerShell usage by transcription and logging
  • Extract and parse structured object out of string content
  • Configure DSC’s Local Configuration Manager with the meta-configuration attribute
  • Configure piece by piece with partial configurations in DSC
  • Manage with cross-computer dependencies in DSC
  • More control over configurations in DSC
  • Find more detail about configuration status in DSC
  • Support for -? during DSC configuration compilation
  • Support for DSC RunAsCredential
  • Rich information for DSC LCM State
  • Side-by-Side installation of DSC Resources
  • PSDesiredStateConfiguration Module version updated to 1.1
  • Discover and install software with PackageManagement
  • Discover modules and DSC resources with PowerShellGet
  • Develop with classes in Windows PowerShell
  • More control and remoting in Windows PowerShell Debugging
  • Report configuration status from DSC to a central location
  • Software Inventory Logging.

Resources



PowerShell 5.0

Thanks for reading! If you have any questions, leave a comment or send me an email at fxcat@lazywinadmin.com. I invite you to follow me on Twitter @lazywinadm / Google+ / LinkedIn. You can also follow the LazyWinAdmin Blog on Facebook Page and Google+ Page.

2016/02/23

PowerShell/SCSM - Get the Work Item parent of an Activity


In the last couple of months, I have been busy on some projects involving System Center Service Manager (SCSM), System Center Orchestrator (SCORCH) and Cireson Portal/Asset Management and I had to script a couple of repetitive tasks using PowerShell.

The following solution allows you to retrieve the parent Work Item of an Activity.

This is useful when you are using a Runbook Activity in your workflow that will invoke a Runbook inside System Center Orchestrator.

Example: In the case where you have a Work Item, a Service Request for instance, with bunch of activities (Review Activity (RA), Manual Activity (MA), Runbook Activity (RBA), etc... ). You could have a Runbook Activity (RBA) calling a System Center Orchestrator runbook.



From a SCORCH perspective it would be useful to find which Work Item the runbook activity belongs to if you want to perform some actions on the Work Item itself and other Activities.
Example: Edit the Work Item Title, Add a reviewer, Skip any Activities with a particular stage, etc...

Here is a PowerShell function that can just do this job for you: Get-SCSMWorkItemParent.


2016/01/25

Microsoft MVP 2016 for Cloud and Datacenter Management

It is a great pleasure and honor to receive for a third year the PowerShell MVP Cloud and DataCenter Management MVP Award!!!


Chère/Cher Francois-Xavier Cat,
Félicitations! Nous sommes heureux de vous remettre le titre MVP Microsoft® 2016! Ce titre est accordé aux leaders d'exception de la communauté technique qui partagent activement leur expertise pratique de grande qualité. Nous apprécions vos remarquables contributions dans les communautés techniques Cloud and Datacenter Management lors de cette année passée.

HUGE thanks to my family, friends and people who support me!!!!!

Some updates:
In the recent months, I have been really busy on many projects at work involving, of course a great deal of automation and using the System Center Suite. Working in the game industry is really fun but you’ve got to keep up the high pace. I'll start blogging soon and I already have a bunch of drafts. There are also a couple of nice scripts and Github projects that I'd like to get out there, and get them eventually published on the PowerShell gallery.

Another reason why I wasn't super present, my girlfriend is currently studying abroad. She returns only during the winter holidays and summer breaks, so I was away from my computer. One has to know one’s priorities!! :-)

Last year, I had organised a few successful PowerShell User Group meetings and I'm looking forward to organizing some more in the coming weeks. The Meetup group is growing fast and it currently shows 126 members; I might need to find a bigger meeting room!!!

Stay tuned!

2015/11/07

Microsoft MVP Global Summit 2015

I just came back yesterday from the Microsoft MVP Global Summit 2015 who took place in the beautiful city of Seattle from the 2nd to 5th of November 2015. This was the second time that I attend this event which was really well organized. I really had a blast meeting with all the MVP and Microsoft teams.

What is the MVP Global Summit ?

The annual MVP Global Summit is one of the best weeks of the year; there is no other technical event like it. Experts in every Microsoft category converge for training, talks, and events. It provides Microsoft with needed product feedback and helps set the mood for the next release of products.



Pictures

Here are some picture of the event and the people I got a chance to hang out with.


2015/11/01

Montreal PowerShell User Group #02 - Materials and pictures



Here is the material from our second Montreal PowerShell User Group meeting that occurred last Tuesday (2015/10/27).

The Powerpoint presentations and PowerShell codes is available on the meetup group page and Github:

https://github.com/lazywinadmin/MTLPUG/tree/master/MTLPUG_02
http://www.meetup.com/MontrealPowerShellUserGroup/files/

2015/10/20

Montreal PowerShell User Group #02 - Using the Pipeline/Creating Script and Function



Join us for the Montreal PowerShell User Group #02 meeting on the Tuesday 27th of October 2015 from 6:00pm to 9:00pm at the Warner Brothers Games Studio!

We will have the two following presentations: Using the PowerShell Pipeline (Beginner level) and Creating Script/Function (Beginner/Intermediate level).

Both presentations will be presented by User Groups members: Martin Lebel and Gary Szabo. (Thank you guys!)

Hope to see you there! Free Pizza, Pop Corn and some games/movies to win!

Presentations


• Using the Pipeline and formatting the output presented by Martin Lebel
• Creating PowerShell Script and Function presented by Gary Szabo

When 


Tuesday, 27th of October 2015 from 6:00pm to 9:00pm

Where


Warner Brothers Games - 888 Maisonneuve Est - 6th Floor
Room: Jack Warner (In front of elevators)