Tag Archives: System Center

Service Manager 2012 PowerShell Exchange “Connector”

There is a Exchange connector for Service Manager but in my experience i think it lacks a bit of features. And it is not possible to configure it as much as i want to. To create a work around for the exchange connector i created a Powershell based “connector”

This is a kind of concept that shows you that you can create awesome stuff with Powershell and tweak you’re mail integration a lot more then with the normal connector.

The “connector” works this way, you schedule it on a management server for a interval of 5 minutes and it will use the exchange web service to look in a mailbox for emails. The script also depends on SMlets. You can download The Exchange web service here and SMlets here

By default it process all emails that has a IR prefix or SR prefix. If it finds a email that does not contain a valid prefix it is processed as trash and an email is sent to the mail sender that it contained a invalid case number.

You can change this behavior to allow all mail that does not contain a prefix or SR/IR so the “connector” will create a new incident with that content. The new incident will use a specified Incident template.

I have tested the script from a Windows 2012 R2 server with Service Manager 2012 R2 (works with UR4 also) and on a office 365 mailbox. It should work against Exchange 2010 for example if auto discovery is configured.

Functions in version 1.0

  • Incident Comments from email
  • Service Requests comments from email
  • Incident attached files added to the Incident
  • Service Request attached files added to the service request
  • Ability to create new incidents from email based on incident templates
  • If the sender of the email does not exists as a CI in service manager database an internal account will be created for that user.
  • All processed emails are kept in a folder in the mailbox
  • If the incident or service request is in the status closed the user gets an email saying the mail was not processed due to cases being closed.

Here is an example for a email that contains attached file. The subject for this email was IR122 and contained the file IR122.txt and the text “This is a test comment sent into IR122 with an attached file”

email_before_incident_process

After the powershell script has run we can look in the action log and you can now see that there is an entry from me and a attached file (Bifogad fil in Swedish)

email_after_incident_process

And on the related object page we can see the attached file.email_after_incident_process_relatedItems

Functions that i am working on in version 1.1

  • Be able to resolve incident by sending [resolved] in the email tag
  • Be able to complete service requests by sending [completed] in the email tag
  • Splitting the code into more functions and modules to get an more easy overview of the code

Download

The script is available on technet gallery. Here is the link.

If you want something more added in future versions just throw in a comment below.

 

SQL Upgrade broke SCSM “Execution of user code in the .Net Framework is disabled”

I recently upgraded my SQL-server with a newer version (SP upgrade). I ran a SQL Server 2012 and when i upgraded some functions stopped working in SCSM. See the error below you get when going into Library -> Groups for example.

Error

This error is easy to fix. Just login to your SQL-studio and run the following command.

Source: http://msdn.microsoft.com/en-us/library/ms131048(v=sql.110).aspx

After this is done just reboot or restart your SCSM-services and now it should work.

Hide/Show service offering based on user access on the SCSM web portal.

I often get the question from colleges if it’s possible to hide specific  service offering/requests on the web portal. This is possible we just need to create a mp, some groups and select the specific users that should view the requests. Se the guide below for more detailed information.

Step 1 – Create a request offering

Create a new request offering and select to create new management pack. This is the MP you will use on all your offerings/requests.

request_1

Enter the information you want.

request_2

Configure the text fields

request_3

Map the values, in this case we only asks for title and description so we map both values into the normal incident class fields title and description.

request_4

Publish the offering

request_5

Step 2 – Create a service offering

Create the offering and select the management pack you created before. service_offering0

Now select the request offering we just created.

service_offering1

Publish the offering.

service_offering2

Step 3 – Create catalog group

Create a new Group. Select the management pack you created in step 1.

group_1

Select the request offering and service offering you want to display.

group_2

Step 4.

Create a new user from end-user template. On the management pack select the MP you created in step 1.

1

Select the MP you created before.

create_user2

Now provide access to only the group you created in step 2.

create_user3

 Step 5 – View the result

Here is the result, i am using the Cireson web portal but this will work with the standard sharepoint/silverlight portal also.

portal_1

The form

portal_2

DPM could not enumerate SQL Server instances

If you recive an error that your databases could not be automatically protected from your DPM-server. And if you runt the script AutoProtectInstances.ps1 and the error looks like below.

error

 

You have to login to the server that has the problem and to the following. Go to the directory c:\Program Files (x86)\Microsoft SQL Server\100\Shared\ and run the following command

Now run the AutoProtectInstances.ps1 script again from your DPM-server and the problem should be fixed.

Check for failed workflow jobs in SCSM using powershell

You might have seen that SCSM uses many workflows for different things. You might wanna take a look on the status of the jobs. If you go to your administration tab and workflows -> status you will se a big list.

scsm_wf_list

You can manually go into each workflow and click on the need attention or all instance tab. This is time consuming and you might only want to see what jobs has failed.

scsm_wf_check

 

One way to get this done is using powershell. If we run the script below.

The output will be something like this below. You can now easy parse all the workflows and check for failed jobs.

scsm_wf_script

 

Be aware that this script is pretty resource heavy. So don’t let it run all the time.

System Center Virtual Machine Manager 2012 – Agent installation failed

When i installed VMM and added a new host i got a strange error (se Picture below). The solution for this problem was a Little strange. I had to install the file server role on my hyper-v hosts and after i did that i could install the VMM agent.

zgc_vmm2012_failed_install_agent

 

 

 

I hope this will help some people out there.