programming scsm with c# and visual studio - schedschd.ws/hosted_files/mms2017/63/programming...
TRANSCRIPT
![Page 1: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/1.jpg)
PROGRAMMING SCSM WITH
C# AND VISUAL STUDIODieter Gasser
@DiGaBlog, [email protected]
Head of Product Management
itnetX, Switzerland
Andrew Craig
@mracraig, [email protected]
Senior Consultant
itnetX, Switzerland
![Page 2: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/2.jpg)
@mracraig
MMS
Senior Consultant @ itnetX
Beard Combs
@DiGaBlog
BSc BIT, Author
Product Management @ itnetX
Retro Games
Andrew CraigDieter Gasser
![Page 3: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/3.jpg)
AGENDA
SCSM Overview
Customizing SCSM
Demo
User Controls / Forms
Workflows
Console Tasks
Debugging
SCSM Key Success Factors
Resources
![Page 4: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/4.jpg)
SCSM OVERVIEW AND
CUSTOMIZATION BASICS
Overview
![Page 5: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/5.jpg)
SCSM Platform
Incident/Problem Service Request Change/Release Data Warehouse Workflows AuthoringCMDB
Connectors & Automation
AD SCCM SCOM SCORCH CSV SDK Exchange
Self-Service
Portal
End Users Analysts / Operators
SCSM Console
![Page 6: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/6.jpg)
CUSTOMIZING SCSM
Just because you can does not mean you
should!
Plan your customizations
What skills and knowledge do you need?
What authoring tools will you use?
XML (Notepad++, …)
Authoring Tool
Visual Studio
Common to all
XML
SQL Queries
PowerShell
C#
What else do you need?
SDK Binaries
SMLets, FastSeal, MPBMaker
![Page 7: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/7.jpg)
USER CONTROLS AND FORMS
Demo
![Page 8: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/8.jpg)
Forms
Example: Form for a custom CI “Car”
Defined in a management pack
Bound to a class
Uses a type projection
References a .NET WPF User Control
Assembly needs to be bundled into a
management pack
User Controls
Example: List picker to select peripherals of a
computer. Added to the computer form
Added to an existing form using form
customization defined in a management
pack
Might need adjustments to the type
projection (if relationships are used)
References a .NET WPF User Control
Assembly needs to be bundled into a
management pack
USER CONTROLS AND FORMS
![Page 9: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/9.jpg)
Form
User Control
USER CONTROLS AND FORMS
Technically, they
are both the same!
1 Form = 1 User Control
1 Form contains 1-many
user controls
![Page 10: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/10.jpg)
Demo:
Creating Forms and User Controls
![Page 11: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/11.jpg)
HIGH LEVEL STEPS
Assembly
1. Project Type: WPF User Control Library
2. Target Framework:
1. .NET 3.5 for SCSM 2012
2. .NET 4.5.1 for SCSM 2016
3. Add references to SCSM SDK
(Copy Local = false)
4. Add a Content Property
(DependencyProperty)
Management Pack
1. Create in Authoring Tool
2. Change assembly and control references
3. Check/alter type projection
4. Add reference to the Assembly
5. Seal the management pack
6. Bundle with the DLL file
Troubleshooting
1. Attach Visual Studio Debugger to SCSM
Console process
2. Temporarily put DLL files in SCSM
Installation Directory on your computer
![Page 12: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/12.jpg)
WORKFLOWS
Demo
![Page 13: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/13.jpg)
WORKFLOWS
Example: Copy Target End Date of SLO object
to Target Resolution Time of Incident
Defined in a management pack
Triggered:
Create/Update/Delete objects/relationships
Scheduled
References a .NET Workflow Activity
Assembly needs to be copied into the
SCSM program directory of the workflow
server
![Page 14: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/14.jpg)
WORKFLOWS
Carefully choose your workflow technologies
Choose least complex architecture
The higher the frequency of execution, the faster the WF should run -> SDK
Technology High-frequency Medium-
frequency/
scheduled
Cross-platform
Applying small changes to
items in SCSM, applying
business rules; workflow stays
“inside” SCSM
Doing periodic checks and cleanups,
sending reports, aggregating or
rolling up data in the SCSM CMDB
Automation across system
boundaries (such as Runbook
Activities)
“Apply Template” (X)
SDK Workflows X (X)
PowerShell Workflows X (X)
Orchestrator/SMA X X
![Page 15: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/15.jpg)
Demo:
Creating Workflows
![Page 16: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/16.jpg)
HIGH LEVEL STEPS
Assembly
1. Project Type: Workflow Activity Library
2. Target Framework:
1. .NET 3.5 for SCSM 2012
2. .NET 4.5.1 for SCSM 2016
3. Add references to SCSM SDK
(Copy Local = false)
4. Add a workflow activity
5. Add Dependency Properties for workflow
parameters
6. Override the Execute method
Management Pack
1. Create in Authoring Tool
2. Change assembly references
Copy .DLL file to SCSM install directory on the
workflow server.
Sealing and bundling the management pack is
not needed.
Troubleshooting
1. Write console program which launches
the workflow
![Page 17: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/17.jpg)
CONSOLE TASKS
Demo
![Page 18: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/18.jpg)
CONSOLE TASKS
Example: Automatically assign an Incident to
a specific support group and add an action
log entry
Defined in a management pack
View States:
Form
View
View with multi-selection
References a .NET Class in an assembly
Assembly needs to be bundled into a
management pack
Console task executed from form:
Item is already in console memoryIDataItem i = Microsoft.EnterpriseManagement.GenericForm.FormUtilities.Instance.GetFormDataContext(node)
Console task executed from view:
Item must be retrieved from management
server firstIDataItem i = Microsoft.EnterpriseManagement.UI.Extensions.Shared.ConsoleContextHelper.Instance.GetInstance((Guid)node["$Id$"]);
Console task executed with multi-selectionIList<NavigationModelNodeBase> nodes
![Page 19: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/19.jpg)
Demo:
Creating Console Tasks
![Page 20: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/20.jpg)
HIGH LEVEL STEPS
Assembly
1. Project Type: Class Library
2. Target Framework:
1. .NET 3.5 for SCSM 2012
2. .NET 4.5.1 for SCSM 2016
3. Add references to SCSM SDK
(Copy Local = false)
4. Add a class inheriting ConsoleCommand
5. Override the ExecuteCommand method
Management Pack
1. Add console task definition
2. Add categories as needed
3. Add image reference
4. Add reference to the Assembly
5. Seal the management pack
6. Bundle with the DLL file
Troubleshooting
1. Attach Visual Studio Debugger to SCSM
Console process
2. Temporarily put DLL files in SCSM
Installation Directory on your computer
![Page 21: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/21.jpg)
Demo:
Debugging with Visual Studio
![Page 22: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/22.jpg)
SCSM KEY SUCCESS FACTORS
Closing
![Page 23: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/23.jpg)
SCSM KEY SUCCESS FACTORS
Established ITIL knowledge
Established ITSM Processes preferred, but not a must
Carefully choose Application Ownership
SCSM is part of System Center, however the Infrastructure Team is rarely a good fit for
managing and owning SCSM
Make them choose an experienced solution integrator
There are many stumbling blocks, experienced SIs know them
Benefit from their experience in other projects
“How do other customers do it” can be beneficial
State-of-the-art infrastructure
![Page 24: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/24.jpg)
SCSM KEY SUCCESS FACTORS
Feasible project plan and milestones
Take small steps – SCSM allows you to do so!
Align with ITIL maturity level
Skilled Engineers
Enterprise Architectures
Relational object models
XML, Scripting, .NET Development
Process-oriented mindset
“Not a geek”
No “Over-Engineering”
![Page 25: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/25.jpg)
SCSM KEY SUCCESS FACTORS
Don’t reinvent the wheel!
SCSM has a big community
Someone is likely to have already solved your problem!
Technet Forums
Blogs
Technet Gallery
Books
Commercial 3rd party Add-Ons
![Page 26: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/26.jpg)
RESOURCES
Management Pack Authoring:
Create Strong Name Key (SNK): sn.exe -k MyKey.snk
Get Public Key Token:
sn.exe -p MyKey.snk MyKey_public.snk
sn.exe -tp MyKey_public.snk
FastSeal.exe:
https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/t
elligent.evolution.components.attachments/01/6241/00/00/03/30/25/60/FastSeal.zip
MPBMaker.exe:
http://www.itnetx.ch/wp-content/uploads/software/MPBMaker-7f8e4c73-fda1-404a-ae4c-
7e7e9d08d642.zip
![Page 27: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/27.jpg)
RESOURCES
SDK:
https://msdn.microsoft.com/en-us/library/hh965050.aspx
Console Tasks:
http://jhnr.ch/2013/12/09/how-to-create-a-custom-scsm-console-task-by-using-some-
c-and-xml-magic/
User Controls:
http://blog.scsmsolutions.com/2011/08/create-custom-user-control-for-scsm-2010/
Workflows:
https://msdn.microsoft.com/en-us/library/hh964702.aspx
Source Code from this session:
https://mms2017.sched.com/event/99aeb04baf0c18d3a367e3965049616b
![Page 28: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/28.jpg)
![Page 29: Programming SCSM With C# and Visual Studio - Schedschd.ws/hosted_files/mms2017/63/Programming SCSM... · PROGRAMMING SCSM WITH C# AND VISUAL STUDIO Dieter Gasser @DiGaBlog, dieter.gasser@itnetx.ch](https://reader030.vdocuments.site/reader030/viewer/2022012304/5a7689c17f8b9aa3618d4b6b/html5/thumbnails/29.jpg)