Nice thing to know!
Changing the maximum number of simultanous Runbooks a Runbook Server can execute!
Great post!
http://www.kelverion.com/optimising-runbook-performance/
A blogg that focuses on posting links to articles that are relevant for a system Center Orchestrator Administrator
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
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.
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).aspxThis 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
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
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
- 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 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
- Integration Pack for PowerShell Script Execution 1.2 - User Guide.docx (updated documentation)
- ExecutePS_1.2.oip (System Center 2012 SP1 – Orchestrator Integration Pack)
Subscribe to:
Posts (Atom)