Saturday, 10 September 2016

PowerShell and SCSM: Incident Managament using smlets - Part 1.

We got introduced to smlets in my last post Getting Started with smlets . SCSM is an ITIL based management tool where we do all management stuffs like Incident Management, Problem Management, Change management etc.

Each organization will have their own SLAs and proprietary way of logging efforts, managing assets and more. SCSM provides all these to be configured and tasks to be done by using its GUI console which can be installed in client Operating systems as well. But when we support such a big application from the backend , we should be able to do operations on bulk items and is a nightmare when we do it in GUI way.

Traditional way.

Lets start with some example tasks.

1. Get all Incident tickets in 'Netowroking Problems' classification.

Say we need to view all Incident Tickets in networking problems classification. We can filter with criteria from the console.

Unfortunately, there is no option to filter with Classification.
But this so simple with smlets.

#Get all Incidents in 'Networking Problems' classification
Get-SCSMIncident -Classification 'Networking Problems'

#To Find available Classifications for Incidents.
Get-SCSMEnumeration -Name IncidentClassificationEnum.Networking

Each and every values for all items in SCSM is stored as enumerations.
You may think, how I know enumeration for Networking classification. You will get it using Get-SCSMEnumeration cmdlet.

 2. Change all Incidents in related to Network issues to Priority 1.

This even can be done using GUI Console which is a headache when we have 100s of Tickets. smlets is the way to do it in a flash. Lets see what all we can do with Set-SCSMIncident cmdlet.

But here, we can't see any parameter named priority for this cmdlet. Yes priority is not a directly settable attribute, but it is a combination of two other attributes, Urgency and Impact which will set value for priority based on SLA matrix designed.

#Changing Priority for tickets in Bulk

Get-SCSMIncident -Classification 'Networking Problems' | 
Set-SCSMIncident -Impact High -Urgent

Below is where we Configure Priority Calculator, Matrix is designed by management.

There are many things we have to on Incident management as an SCSM Administrator, We'll cover some of them in Part 2.

Monday, 29 August 2016

PowerShell and SCSM : Getting started with smlets

System Center Service Manager aka SCSM is a management tool within System Center Suite. SCSM doesn't have much popularity while we compare it with its siblings (SCCM,SCOM,SCVMM etc.),even though Microsoft has provided a bunch of PowerShell cmdlets for managing and automating administrative task from the shell which is in the module Microsoft.EnterpriseManagement.Core.Cmdlets . This module comes within the SCSM.But still all the tasks which we do from the GUI console in SCSM is not possible to Automate using the default module.

Here comes our opensource SCSM module smlets, you can get it from codeplex and PSGallery.

Lets see how many cmdlets we have in smlets.

we have around cmdlets to manage SCSM using smlets.

Lets have a look on those, just a look.

We'll explore some of very important and usefull cmdlets in future posts.

Have Fun Exploring the Shell >_

Saturday, 25 June 2016

Hidden Formatting

Recently I was working on a PowerShell project and faced a challenge which I came to know as very important to share when I got the solution.


Lets start with the same cmdlet I used,

I used the above cmdlet and got the output as expected,

My intention was to get IPv4 DNS Addresses only , So I tried to filter with 'Address Family' and the output was null, nothing !!!

I thought of investigation it and tried Select-Object on AddressFamily property and I got bellow output which is really unexpected.

So there is some formatting happening behind the scene. Lets explore it ...

First we need to know in which module this cmdlet is in to explore the module specific formatting file.
As usual , Get-Command -Name Get-DnsClientServerAddress | Select-Object -Property module

I got to know that this cmdlet belongs to 'DnsClient' module, so next we have to go to the module folder for further investigation.
Lets open the module folder with a one liner.

Get-Module -Name (Get-Command -Name Get-DnsClientServerAddress | Select-Object -ExpandProperty module) | Select-Object -Property path | Split-Path -Parent | Invoke-Item

Here we got the Module specific formatting file for DnsClient module, now we need the type of object generated by Get-DnsClientServerAddress cmdlet.

As usual using Get-Member

Get-DnsClientServerAddress | Get-Member

Lets open the formatting file and search how they configured formatting for this type of objects.

Here we got how the formatting is done for this cmdlet. you can see here for the Property AddressFamily there is a respective script block which outputs 'IPv4' and 'IPv6' based on the actual value for AddressFamily.

Similar formatting is done for many other PowerShell cmdlets like Get-Process, Get-ChildItem etc.

Have Fun Exploring PowerShell