Overcast » Blog Archives

Author Archives: admin

Reporting SCSM

Customizing SCSM 2012 R2 Incident Report to show the Classification Category

Published by:

As much as possible, with Service Manager 2012, you will want to use what is provided out of the box, to avoid class and report customizations that can take a long time to be completed and will need maintenance in the future. However, very often, you won’t be able to avoid. This one came as a request from a customer. They wanted to use the out of the box Incident list report. This report will allow you to filter the Classification category of the incidents. However, you are not able to see to which category the incidents belong too unless you review the details of the Incidents:

image

image

And the resulting columns look like this:

image

Doesn’t it make sense to have a column showing the category of each incident, as below:

image

I believe so, and I will show you how to accomplish that.

First, let’s take a look at how the report has been built. MS often uses a good amount of code in the reports and also in the SQL engine, by using Stored Procedures. This is the case here.

By opening the report in Report Builder, you’ll notice right away that most of the data is based on expressions:

image

Let’s take a look at the dataset first:

image

As you can see below, the data is generated by an Stored Procedure:

image

You can actually find it in SQL Mgmt Studio:

image

And it looks something like this:

image

In order to spit out the Classification category, we need to add a few lines to it:

Around line 98, you should add the comma (,) and the line below.

image

After that, around line 150, you should add the highlighted LEFT OUTER JOIN:

image

And you should be good on the SQL side. Execute the Stored procedure to save it:

image

Now for the report. In Report builder, you will first need to update the fields, to add the category to the mix:

image

Hit Refresh Fields:

image

Once you do, you should see Category in the list:

image

You can now just drag and drop it to the existing table:

image

I Have changed the color to black (originally blue). I also have right-clicked the text box:

image

 

And set the Interactive Sorting:

image

Save the report and you can now run it from the Console!

Hope this helps!

Uncategorized

Setting up an Extended Description field with user input

Published by:

A while ago, I have blogged on how to leverage the userinput stored (tipycally) in a Service Request from Orchestrator, to avoid too many class customizations. Very often, customers want all the Userinput to be stored in the Description or Notes field of a Service Request. I used to do that in Orchestrator as well. For sake of learning and practical usage, I have decided to use basically the same script and create an SCSM workflow to allow for the Description (or another custom field) to be populated with the contents from the User input.

Let’s take a look at how things work.

First of all, the core of the solution. To implement it, you will need a few things:

– Create a new class extension of the Service Request class in the Authoring Tool;

– Create a workflow to be executed whenever the Service Request status changes to In Progress

Creating the class extension

In the Authoring Tool, extend the service request class and add these two properties:

image

In this case, I have decided to add a second (extended) description field but the existing Description field can be used as well.

Update: I have added a second control field, in order to make sure that I would only notify when the description (or extended description) had been updated:

Now my extended class looks like this:

image

The default value for UserInputProcessed is false:

image

Create a workflow for the Service Request class:

image

image

image

image

image

image

image

Drag a powershell activity:

image

Into the new WF:

image

In the script parameters, add ItemID:

image

And link it:

image

 

Now for the script you download it here. You will open the file and paste it here:

image

Important Note: this scripts uses both the SCSM 2012 cmdlets and the famous SMLets.

The latter should be installed. You may want to reboot you server just so the powershell modules can recognize the new CMDlets.

Once you have it there, all you need to do is create a new template for the Service Request and set whether you want the workflow run the script or not:

image

Apply this template to a new Request Offering, put in a request and once it has been processed, you should see the contents of the user input transported into the ExtendedDescription field.

For my testing, I have created a Request Offering with most of the possible field types:

image

And here is the content:

image

In order to properly notify, use a notification subscription as below:

image

image

image

Hope this helps!

Uncategorized

Azure Operational Insights–Quick Starting guide

Published by:

Or…what happened when I’ve tried.

I had an on setup of SC Advisor, which I had attached to OpsInsight automatically. However, that revealed to a be a bit confusing and for the sake of the new users out there, I’ve decided to start over.

So, I have leveraged a new account I have in my Azure AD to create a new WorkSpace in AOI.

image

image

image

Yey! Ok, so, where do we start… I know I have to add servers, but where…I also know I can leverage Operations Manager to do it, but I want to start simple.

Maybe it is here,since the word Servers is here…

image

Ok, it seems to be the right way:

image

Let’s try configuring:

image

Hum, looks promising!

image

So, I have downloaded the agent and will install it in my brand new SCSM portal server.

image

Same issue you have if you try the SCOM agent:

image

Let’s try another server for now:

That looks suspiciously familiar:

image

That’s new!

image

image

And finished:

image

In Control Panel, very similar to Operations Manager:

image

Now back to the portal:

image

Nothing there yet!

In the meantime, let’s add some Intelligence Packs. Let’s try this one first:

image

image

image

I will be back to evaluate the IPs when data has been populated and some more agents have been deployed!

Hope this helps!

Uncategorized

Using Azure Active Directory with PowerShell

Published by:

image

I had a situation where I had my lab domain synched with Azure, but later I had to use the same domain for my office 365 accounts. I had a lot of funny accounts using very simple passwords, so, I didn’t want that to possibly compromise my local domain access. I then tried to delete the users, but it seems you can only do one at a time.

Enters PowerShell! In order to do that, you will need to install a couple of binaries, as stated here:

http://msdn.microsoft.com/en-us/library/azure/jj151815.aspx

Once you have this in place, you can play a bit:

image

When you run the last command above, you will be prompted for credentials. Log on as a an Azure AD Admin.

Then you can see domains, users, etc:

image

There is a good number of commands:

image

What I really wanted was to be able to delete users in bunk. To avoid risks with patterns, let’s use a PowerShell feature I can’t get tired of: Out-GridView!

image

image

Isn’t it lovely?

Now, let’s add some action to it!

You can pipe it to the Remove-MsolUser cmdlet and pick the users you want to be deleted:

Get-MsolUser | Sort-Object DisplayName | Out-GridView -PassThru | Remove-MsolUser

image

And there: gone!

You can add the –Force to the last command just so you don’t get prompt for every user to be deleted:

image

This is probably very well know for office 365 users, but I thought it was worth mentioning now that Azure is becoming more and more popular.

Hope this helps!

Uncategorized

Custom URL Monitoring Library for SCOM 2012

Published by:

Recently, a customer that uses the SCOM URL monitoring extensively reported a few issues they had been having with the standard URL (Web Transaction) monitor. Some of them were resolved by using the new availability template (repeat count). However, the latter won’t support authenticated URL queries. In order to fix that, I have developed a small URL Monitoring library. You can get it here. Below, find an example VSAE snippet and a small step by step on how to use it.

I have learned a great deal about the ‘invoke-webrequest’ cmdlet. By the way, make sure the watcher node you select by override is at least a Windows Server 2012 (Powershell 3.0 is required for this cmdlet). Additionally, the MP is ONLY compatible with SCOM 2012, since it uses certain components only available in SCOM 2012, namely, the SuppressionSettings in the System.ExpressionFilter .

Here’s the snippet.

The monitor (and web performance rule) accept the following parameters:

<url>#text(‘url’)#</url> –> the URL. Easy.
<timeout>#text(‘timeout’)#</timeout> A timeout for the operation. If the request takes more than this, the monitor will fail.
<matchingstring>#text(‘matchingstring’)#</matchingstring> [Optional] A string to match to consider the monitor as VALID!
<Interval>#text(‘interval’)#</Interval> The interval between the URL checks
<SyncTime>08:00</SyncTime> Synctime. To make things next or if you want, say do it daily or do it 3 times a day, starting 8:00AM for example.
<matchcount>#text(‘matchcount’)#</matchcount> How many time the monitor must fail before triggering the Alert.
<withinseconds>#text(‘withinseconds’)#</withinseconds> How far back should I look to consider the failures, say, 180 seconds or something the like. Usually will be matchcount * interval.

<debug>0|1</debug> – [Optional] enables or disables debug. Default is disabled.

Having the snippet handy, create a new VSAE project:

image

imagename it…

Add the Reference to the Library

image

image

Once there, add a new item:

image

Pick Snippet Template:

image

Past the contents above and save it:

image

Now add a new item:

image

And select:

image

Don’t forget to name it properly.

Select the Snippet:

image

image

Configure as below:

image

Save it and…

image

Ta da! There you go!

let’s build this:

image

And here’s our output:

image

I don’t like those underlines there,so, let’s fix this:

imageand

image

After a new build:

image

Much better.

Let’s import the library into SCOM:

image

image

Once imported, if you need authentication, set the Run As Profile:

image

image

Now, let’s import the MP with the monitors:

image

You should see the monitors here:

image

You should also see a performance collection rule, which also needs to be enabled, using an override. When added to a view, it should look something like this:

image

Hope this one helps!

Automation Azure MVA

Very Useful MVA Courses

Published by:

imageIf you have never checked Microsoft Virtual Academy, stop what you are doing and go check it! But grab a coffee first. There is a lot available to learn. I have separated a few very useful courses in the Azure side for you to take. I really encourage you to explore more and find other interesting ones and share with me and others.

Here’s the list!

Check out this course to explore the process of automating the cloud with Azure Automation. Find out how to get started and how to connect to Microsoft Azure. Learn how to import and publish a Connect-Azure runbook, and create and publish your first runbook. Finally, invoke Azure Automation runbooks, and discover next steps.

http://www.microsoftvirtualacademy.com/training-courses/automating-the-cloud-with-azure-automation?prid=ca_ITProMVP_ALL

IT Pros, are you planning to expand your datacenter into the cloud or exploring the possibility? Want to learn what it would take? In this course, get the information you need. Experts Aleksandar Đorđević and Predrag Jelesijević walk you through an overview and explore key scenarios in Microsoft Azure and Windows Server. They even show you practical demos that explore, in detail, how to create a site-to-site (S2S) virtual private network (VPN) connection and how to connect a site-to-site VPN.

http://www.microsoftvirtualacademy.com/training-courses/microsoft-azure-site-to-site-vpn?prid=ca_ITProMVP_ALL

Azure RemoteApp combines Windows application experience and powerful RDS capabilities on Azure’s reliable platform and helps IT to bring scale, agility, and global access to corporate applications. In this course, learn more about how to scale up or down to meet dynamic business needs without large capital expense or management complexity, how to provide access to corporate applications from anywhere, on any device, and how to centralize and protect corporate resources on the reliable Azure platform.

http://www.microsoftvirtualacademy.com/training-courses/corporate-apps-anywhere-anytime-with-microsoft-azure-remoteapp?prid=ca_ITProMVP_ALL

 

Hope this helps!

Azure

Azure Subscription Billing Alerts Preview

Published by:

In preview now, the Azure subscription Alerts feature will let you configure alerts regarding your usage

Simple steps to get there. If you don’t have a subscription yet, request a free monthly trial here.

Once you have you subscription setup, head to the preview page and request to join it.

image

You will shortly receive an welcome e-mail.

Once in, you can set up to 5 alerts:

image

Not a lot of options yet:

image

image

But useful nevertheless!

Once enabled, you should get a confirmation:

image

Happy ‘Clouding’!

Uncategorized

SCSM–Determining a user’s e-mail using powershell

Published by:

Continuing the series on how to survive deploying Service Manager 2012, here’s another script that helped me get through the day without going mad.

This one will look for the user’s e-mail in the CMDB. As you may already know, the e-mail is not a direct property of the object. It is a relationship between two different objects. Therefore, you need to determine that relationship instance and get the related object. Particularly, the notification objects can be many (different e-mails, SIP, SMTP,etc).

The script for 2008 R2 is a but cumbersome and not elegant:

 

[sourcecode language='powershell' ]
#first check for the SCSM module
if((Get-Module -Name System.Center.Service.Manager) -eq $null)
{
    import-module 'C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\System.Center.Service.Manager.psd1'
}
#I have used display name here. You can likely user another more restrictive property
$DisplayName="My Display Name"
#establish the connection to the SCSM MG.
New-SCSMManagementGroupConnection -ComputerName "SCSM Server"
#finds the system.userhaspreference relationship
$userprefrenceclass=Get-SCSMRelationship -name system.userhaspreference
#finds the user class
$userclass=Get-SCSMClass -name  system.user
#finds the user itself
$user=Get-SCSMClassInstance -Class $userclass | ? {$_.DisplayName -eq $DisplayName}
#gets a notifications
$notif=Get-SCSMRelationshipInstance -SourceInstance $user | where {$_.RelationshipId -eq $userprefrenceclass.Id}
#since there are a lot of them here, run though and find the one you need:
foreach ($targetaddress in $notif)
{
    foreach ($value in $targetaddress.Targetobject.Values)
    {
        if ($value.Type -match 'TargetAddress' -and $value.Parent -match 'SMTP')
        {
            $email=$value.Value
            break;
        }
    
    }
}
[/sourcecode]

Now the 2012 R2 version:

 

[sourcecode language='powershell' ]
Import-Module 'C:\Program Files\Microsoft System Center 2012 R2\Service Manager\Powershell\System.Center.Service.Manager.psd1'
$DisplayName="My display name"
New-SCSMManagementGroupConnection -ComputerName scsmserver

$userprefrenceclass=Get-SCSMRelationship -name system.userhaspreference
$userclass=Get-SCSMClass -name  system.user
$user=Get-SCSMClassInstance -Class $userclass | ? {$_.DisplayName -eq $DisplayName}
$notif=Get-SCSMRelationshipInstance -SourceInstance $user | where {$_.RelationshipId -eq $userprefrenceclass.Id}
$emailobject=$notif.TargetObject.Values | ? {$_.Type -match 'TargetAddress'}
$email=$emailobject.Value
[/sourcecode]

Shorter, more elegantt, no need of ‘foreach’.

 

Hope this helps!

Uncategorized

SCSM–Determining a user’s manager using PowerShell

Published by:

I have been working with SCSM again recently and had to get creative using Orchestrator, since some of the native features of SCSM won’t allow for certain things.

One thing I had to do was to be able to notify certain users (in Orchestrator) at different points of my Runbooks and also determine their managers. In order to do that, I had to know, for example, the name of the manager for determined user. Fetching any of the related users in Orchestrator is relatively straight forward, but since its manager is not a normal property, you need find the correct relationship and find out the exact one you need, keep digging until you find the right type and then get the manager’s name.

I wrote this on a 2008 R2 server, PowerShell 2. Which is good an bad. If you notice, some pipelining is much easier in PS 3.0 and on., but may not work everywhere.

But here’s how it goes:

[sourcecode language="powershell"]
#Going to look for this Display name
#I have used display name here. You can likely user another more restrictive property
$DisplayName=&quot;A user display Name&quot;
try
{
    #first check for the SCSM module
    if((Get-Module -Name System.Center.Service.Manager) -eq $null)
    {
        import-module 'C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell\System.Center.Service.Manager.psd1'
    }
    #establishes the connection to the SCSM MG.
    New-SCSMManagementGroupConnection -ComputerName 'SCSMServer'
    #Find the relationship class for managing users
    #The relationship works both ways. See below.
    $usermanagerclass=Get-SCSMRelationship -name System.UserManagesUser
    #gets the user objetct class
    $userclass=Get-SCSMClass -name  system.user
    #then the user itself
    $user=Get-SCSMClassInstance -Class $userclass | ? {$_.DisplayName -eq $DisplayName}
    #if user found:
    if ($user -ne $null)
    {
        #Finds the object related to the User (the manager, in this case, since I have set the TargetInstace parameter to be the user)
        $relInstance=Get-SCSMRelationshipInstance -TargetInstance $user | where {$_.RelationshipId -eq $usermanagerclass.Id}
        #if you want, you can set the -SourceInstance parameters as the user and then you will get the users MANAGED by that user
        #fetch the display name you are looking for
        $managerDisplayName=$relInstance.SourceObject.DisplayName
    }
    else
    {
        Write-Output &quot;Error finding user&quot;
    }
}
# Catch any errors
catch
{
# Return the error details
   Throw $_.Exception
}
[/sourcecode]

This can be easily imported into Orchestrator, either running locally (provided you have the SCSM console bits installed) or in a remote session. Just replace the $DisplayName line and the SCSMServer in the script by parameters of your Runbook.

image

Hope this helps!

SCOM

Safely closing any type of alert in the SCOM Console

Published by:

More than often, you would like to be able to just close an alert in the SCOM console. Easy, right? And it actually is. But simply closing an alert in the console may not have the same effects if you are dealing with alert generated by monitors or alerts generated by rules.

Because of the way SCOM works, you usually can safely close alerts that are generated by rules, since if the condition repeats, the alert will come back. However, with monitors, by simply closing the alert, you may not see the alert again, unless there is a state change, why may never ever happen again. This can be particularly dangerous if you have, for example, a disk space alert. If you close the alert and disk space continues to be consumed, you will never get a new alert until the state flips again.

At a first glance, it may not seem to be necessary, since monitor will close by themselves. However, there are two main reasons: First, people seldom know what is the difference between a monitor or a rule and don’t know exactly how to determine that (and they frankly don’t care). Second, I’ve seen some specific monitor that won’t close by themselves (manual reset) and even some EventLog based monitors that will fail to find the Unhealthy condition and therefore, you’ll have an eternal alert in your console.

My suggestion here is an Alert console task, that will figure out where the alert was generated by a monitor or rule, then determine the best way to get rid of the alert. Remember that either way, if the problem is still there,you’ll still get a new a alert when the problem comes back.

The steps are pretty simple.

Open your SCOM console and navigate to the Authoring area, select Tasks and create a new task:

image

Select an Alert Task

image

Select a management pack (it is common knowledge, but always worth mentioning: Never used the Default MP!)

Name it

image

Configure as below:

image

Now, create a folder on ALL your computer that have a console. This is needed because it is a Console tasks, so, it happens wherever the console is.

image

Here’s the script.

The usage should be simple:

image

And the output:

image

In case the alert was generated by a rule, should be the same:

image

 

Now the comments on the script itself. Basic SCOM connectivity:

image

Find the alert:

image

If it finds it and it was generated by a monitor, it will find the instance of the monitor for object and reset the health of that monitor, for that instance only:

image

If generated by a rule, it is safe to just close it (set the resolution state):

image

Hope this helps!