Thursday, November 28, 2013

MTUG: Presents Travis Wright - Automating datacenters and client management

 
Cireson is in Town and we got Travis Wright to hold a Session for MTUG OSLO.
This is going to be a great session on the following topics:
  • System Center Service Manager
  • Orchestrator (SMA)
  • Powershell
  • Azure
Join this session free session @ http://www.meetup.com/MTUG-System-Center/events/150733802/
 

Wednesday, November 27, 2013

Orchestrator: Problems with access to the Orchestrator Console after SP1 Upgrade?

Well..  Orchestrator SP1 has been around the block for a while now and I came across a weird thing the other day.

The customer had a problem with the Orchestrator console in their Runbook environment and  got this message when trying to access the web console remote.









So I logged on to the Webservice Server (locally) and tested again..


 













Still no go...

It seemed like I did not have access to the directories. So I opened the IIS console and selected the
"Microsoft system center 2012 Orchetsrator Web service" site and selected [basic settings].
In the "Edit Site" I tested the settings to check that the results was valid.



The Test Connection failed on the Authorization, and saying that the account used could not access the installation directory. (Strange because my installation account has full permissions on the path).

Back in the edit Site again I could see that the "Microsoft system center 2012 Orchestrator Web service" site was linked to the DefaultAppPool and not the system Center Orchestrator Web Feature pool. (installed during installation).
















So I changed it back to the right Application Pool and did the test.




 
















Now the result was valid for both the tests.

On a remote computer I opened up the Orchestrator Web Console and it worked perfect again.











 

Monday, November 25, 2013

Orchestrator: Search for Text in a textfile with Regluar Expressions

Well I had a case the other day where I need to search for a username in a textfile and add the username as affected user in Service Manager. So I started to work on my plan on how to make this dynamic and bulletproof.

Here is a snip of the textfile:












The line that I am looking for is "Affected User: u2121" and my goal is to get only the u2121 id everytime the activity is run in different text files.

So how can I do this? Well then I remembered Regular expressions. What did Technet say on that subject again?

Regular expressions let you match a string to a pattern. The regular expression can contain a number of different elements that define the pattern. 

Hmm... Pattern.. Interesting..  I know that all ID here start with a U and a chain of number like
 u2121,u3434,u1414,u3535 and so on... So regular expressions it is

Affected user: u2121 was the text in the textfile. If the ID would have the following pattern in every textfile searched we can use a regular expression.

 In the Search text I added u[1-9]+ and selected "Use regular expressions".













Then I did a test, and the matched text showed the ID in the textfile, Nice!.










So let's look at the text I searched for again. Well all ID started with a u then that would be my first search query. (Simple ;)

Then I know that the rest is numbers between 1-9. So I added [1-9] which means all between 1 and 9.

But the number of characters on the ID's was sometimes 4,5,6. so I added the + to the end to match all of them. Now it will find the ID either it is with 4,5,6 characters.

This was a quick intro in this and there are plenty of combinations to use. Check it out!

http://technet.microsoft.com/en-us/library/hh440535.aspx

Wednesday, October 23, 2013

Friday, October 18, 2013

Orchestrator: Get Email Address of a SCSM user CI

When working with orchestrator there might come a day when you need the Email address of a SCSM user Object. This could be if you are going to used the Send Mail activity in a runbook.

When opening up a CI object in Service Manager we can see under the Notification tab that there is defined a SMTP address to the CI object. This is the address that SCSM will use when sending notifications in workflows and so on..

 This is because this is a combination object to the user object. So to find the email address we need to do some powershell magic in the runbook to find the email address.

To find the email address in powershell, I will be using the SMLETS module extension that includes  cmlets for managing Service Manager through PowerShell.

You can find this module on Codeplex:
http://smlets.codeplex.com/

Install the smlests on the Service Manager server.

The reason for this is that we do not want to have the Powershell module to be loaded on the Runbook server. So in order to use powershell against SCSM, we will use remote powershell.

The Runbook server will start a powershell session on the SCSM server by using remote powershell.

By default as you probably know, running remote powershell on a server is a no go. To do this you need to open up for remote management on servers. 

1.Set-ExecutionPolicy RemoteSigned (depending on your security settings in the environment)

2.If Windows Remote Management (WinRM) is not installed and configured, WinRM scripts do not run and    the Winrm command-line tool cannot perform data operations.


Command: Winrm quickconfig
http://msdn.microsoft.com/en-us/library/aa384372(v=vs.85).aspx
This can be performed in several ways based on your security policy.

Now when this is done, open a new runbook and select the "Run .Net Script" activity and add the following script:

$session = New-PSSession -ComputerName OSLWVSSM001L
    Invoke-Command -Session $session -ScriptBlock {
        
        Import-Module smlets
        $Userdisplayname = "DISPLAYNAME OF THE USER "
        $userpreferenceclass = Get-SCSMRelationshipClass -name system.userhaspreference 
        $class2 = get-scsmclass -name system.user$ 
        $user = Get-SCSMObject -class $class2 -filter ”Displayname -eq $Userdisplayname”
        $mail = (Get-scsmrelatedobject –smobject $user –relationship $userpreferenceclass | where{$_.displayname –match “smtp”}).targetaddress
             
    }
    $mail = Invoke-Command -Session $session -ScriptBlock { $mail }

Remove-PSSession $Session

The "DISPLAYNAME  OF THE USER" needs to be gathered from a source. This could be a SCSM Get-Object activity, where the name is published to the .Net Activity.

The Displayname needs to match the display name of a CI user in SCSM, if not the script will fail in the lookup.


Then we need to publish the result to the next activity.

In this example the variable "mail" in the PS will be mapped to the Published Data called. "Email Address".


The Email address will now be available to use in a Send Mail activity.

Just to point it out! Editing directly in the ".Net activity" is not a preferred way of working with powershell in Orchestrator. The editor do not support CTRL -Z and gives you more trouble that good functionality. So working with the command in "Notepadd++ , "Powershell ISE" or another tool is a better approach.




Wednesday, October 9, 2013

Orchestrator: Integration Pack for PowerShell Script Execution 1.2

New Integration Pack for Powershell now available in version 1.2
View this Article on technet gallery by Charles Joy.
http://gallery.technet.microsoft.com/Orchestrator-Integration-438f9ece

This Integration Pack provides extended PowerShell Script Execution capabilities for the Orchestrator (executed from and against both x86 and x64 OSs).

For more information, please refer to the blog post announcement(s) for this contribution:

 http://blogs.technet.com/b/privatecloud/archive/2013/10/01/automation-orchestrator-integration-pack-for-powershell-script-execution-version-1-2.aspx

 http://blogs.technet.com/b/building_clouds/archive/2013/01/31/automation-orchestrator-integration-pack-for-powershell-script-execution.aspx

 http://blogs.technet.com/b/charlesjoy/archive/2011/05/04/ois-integration-pack-for-powershell-script-execution-1-00.aspx


This Integration Pack adds the following activities to the Orchestrator:

  • Execute PS Script
  • Execute PS Script - Global
What's New?
  • New IP Connection - Authentication Method - CredSSP
  • New IP Global Connection / Activity Functionality - Get Host Name from Activity
  • New IP Activity Execution Option - Execute Asynchronously

    NOTE: Much more detail is provided in both the associated blog post(s) and included documentation.
System Requirements
  • System Center 2012 Orchestrator (SP1+)
  • System Center 2012 Orchestrator Integration Toolkit (SP1)
  • Microsoft .NET 3.0 Framework
  • PowerShell 2.0+
  • winrm quickconfig command executed on local and target machines where PS Scripts will be executed
  • Enable-WSManCredSSP for Client and Server roles as needed if CredSSP functionality is desired
Included in the download (Orchestrator Integration Pack for PowerShell Script Execution 1.1.zip):
  1. Integration Pack for PowerShell Script Execution 1.2 - User Guide.docx (updated documentation)
  2. ExecutePS_1.2.oip (System Center 2012 SP1 – Orchestrator Integration Pack)
NOTE: Please Refer to the included User Guide for usage information.

Thursday, June 27, 2013

Orchestrator: Error deploying Service Manager IP to Runbook Servers

I have come across one thing that i thought was nice to mention here. I have been working with a customer that have only one runbook server that includes all the roles.
 
So the other day they needed to add a new runbook server "More horse power" to the solution.
 
So they installed the new server and deployed the new role from the "Deploy manager".
 







 
Select the server name and an account that has administrative privileges to install the Orchestrator runbook server role on the server.
 
 


On the "Deploy Integration Packs or Hotfixes" selected the "Service Manager 2012" integration pack. 

 
 
In the logs the deployment of the Runbook server was successful, but the deployment of the integration pack the status was "Fatal error during installation".

 
 
 
Fatal error in my opinion sounds very bad. So I needed to find some more information about this "Fatal error"....
 
When you deploy new roles, hotfixes and IP in Orchestrator from the Deployment Manager, you can view the logs and see what happened during the installation.
 
Right click and select [View Deployment logs]
 
 

 
Every time you make a change to the roles or add a new feature, there is created a new log.
 
 
So I open up the log from the "Service Manager IP".
 
I searched through the log file and found this:
CAQuietExec: Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.5420
CAQuietExec: Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.
CAQuietExec:
CAQuietExec: RegAsm : error RA0000 : Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
CAQuietExec: Error 0x80070064: Command line returned an error.
CAQuietExec: Error 0x80070064: CAQuietExec Failed
 
When a log often contains "The system cannot find the specified file" it mean that something is missing and the version=3.5.0.0 gave me a clue..
 
.Net framework 3.5....
 
So I logged on to the server and installed the .Net 3.5 and hit the deployment button again.
 
This time the deployment was successful, or as we say in Norwegian "Herlig" (trans:Perfect/lovely).