34
Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja http://aka.ms/ConfigNinja Brett Bennett @texasmcse http://aka.ms/breben

Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja Brett Bennett @texasmcse

Embed Size (px)

Citation preview

Page 1: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Got Reports?Let me show you how in SCCM

Santos Martinez@ConfigNinjahttp://aka.ms/ConfigNinja

Brett Bennett@texasmcsehttp://aka.ms/breben

Page 2: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

#MMSMOA

@ConfigNinja

Senior Premier Field Engineer at Microsoft (five years at MS)

co-author of Mastering series

11 Years of Experience and Fourth Degree Black Belt

5 SQL MVP

2 ConfigMgr MVP

Shihan Sensei TaiFu Shoi Karate-Do (Ninja)

Santos Martinez

Page 3: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

#MMSMOA

@texasmcse

Senior Premier Field Engineer at Microsoft (10 years at

MS)

co-author of Mastering series

Have worked with SMS/SCCM

in various capacities since

SMS 1.0 Beta

Brett Bennett

Page 4: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

We are giving away two copies during this session

Get your book signed!

Page 5: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

ground·work [ˈgroundˌwərk]NOUN : : “preliminary or basic work” "an SCCM admin should ensure that he/she has completed the groundwork before writing awesome reports”

Page 6: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

SQL Reporting Services

The CM2012 Reporting Services Point role uses SQL Reporting Services (SRS)SRS is part of Microsoft SQL ServerSRS has many benefits:• SRS used in many products• Utilizes standardized query language (T-SQL)• SRS is scalable, features high performance• Your SQL DBA’s probably already use SRS and understand it• Reports can have subscriptions & can be exported to a variety of file formats

Page 7: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

SQL Reporting Services (continued)

A CM2012 hierarchy can have multiple reporting services pointReports are not replicated to other sites in the hierarchyReports run against the local CM database

Page 8: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Optimizing SQL

Make sure SQL server is configured properly and operating at peak performanceWatch for CM database fragmentation (scheduled reindex)Check SQL minimum and maximum memory configuration• Minimum: 8192MB• Maximum: 50% of total RAM for co-located SQL, 80% of total for

remote SQL

Add additional tempdb files (one per CPU, up to 8 files)Check CM database and transaction log autogrow settings

See our session “Talking Databases” at 3PM in Lakes D today for more info on CM database tuning and configuration

Page 9: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

frame·work [ˈfrāmˌwərk]NOUN : : “an essential supporting structure of a building, vehicle, or object (or report!)”"an SCCM admin should ensure that he/she understands the SCCM report framework before writing awesome reports”

Page 10: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

WQL vs T-SQL

WMI Query Language (or WQL) is a Microsoft implementation of a query language for the Common Information Model (CIM)WQL is used in CM2012

Transact-SQL (or T-SQL) is a Microsoft extension to the Standard Query Language originally developed by IBMT-SQL is used in SQL server

They are both SQL queries so the commands are interchangeable, right?

Page 11: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

WQL vs T-SQL (continued)

Scenario: You created a query in CM2012 that you want to use as the basis of a new report. How?

Run the query in CM2012 consoleUse the SMS Provider log (smsprov.log) to see the translation from WQL to T-SQLTest the T-SQL query in Query Analyzer in SQL Management StudioUse the T-SQL query in the dataset in Report Builder

Page 12: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

WQL vs T-SQLWQL

select SMS_R_System.Name, SMS_R_System.OperatingSystemNameandVersion from SMS_R_System where SMS_R_System.OperatingSystemNameandVersion like "%Windows 10%"

T-SQL

select all SMS_R_System.Name0,SMS_R_System.Operating_System_Name_and0 from vSMS_R_System AS SMS_R_System where SMS_R_System.Operating_System_Name_and0 like N'%Windows 10%'

Page 13: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Tables vs Views

SQL tables are used to store dataSQL views are virtual tables, optimized for accessing data via queries, reportsAlways use views* when creating queries for reports, never tables•Microsoft does not support CM reports based on tables•Database tables may be renamed during upgrades, views are typically not

* (or RBAC functions, more on that soon)

Page 14: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

What about RBAC?

Role-Based Access Control (RBAC) is key feature in CM2012RBAC uses security role, scope and collections to determine which CM objects an admin can accessCM2012 RTM introduced RBAC in the consoleCM2012 R2 introduced RBAC for reportsAll native reports in CM2012 R2 are RBAC-enabled

Page 15: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

What about RBAC? (continued)

When creating reports, you will need to decide:Is report security a concern at your company?

Page 16: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

DemoRBAC vs non-RBAC Reports

User: Joe Admin

• Joe’s security Role – Operations Administrator

• Joe’s Scope – Default

• Joe’s Collections – Windows 8

Page 17: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

What about RBAC? (continued)

When creating reports, you will need to decide:Is report security a concern at your company?

If YES, use RBAC functions when creating queries for reports (example: fn_rbac_gs_operating_system)

If NO, use SQL views when creating queries for reports (example: v_gs_operating_system)

Page 18: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

What about RBAC? (continued)

Use View Dependencies in SQL Server Management Studio (SSMS) to analyze the relationship between a function and a view

Page 19: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Creating the Query

Query tools• Query tool in SQL Server Management Studio (SSMS)• Query Designer in SSMS • Notepad (if you are a query expert ) and then copy/paste to Report Builder• FlySpeed SQL Queryhttp://www.activedbsoft.com/overview-querytool.html

Verify your query is optimized, efficient• SET STATISTICS IO ON• SET STATISTICS TIME ON

Use these tools that are included in the query tool in SSMS for additional insight:• Analyze query in Database Tuning Advisor• Include Actual Execution Plan• Include Client Statistics

SQL Sentry Plan Explorer is a third-party tool for viewing SQL performance (sqlsentry.com)

Page 20: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Report Creation Tools

What tools can I use to create reports?• Report Builder 3.0 • Business Intelligence Development Studio (BIDS)• SQL Server Data Tools

Which one should I use?• Report Builder 3.0 is available as a standalone app and ClickOnce• Report Builder more intuitive, may be easier to understand and use

Page 21: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Now that you understand the groundwork and the framework we can start the real work of creating reports in CM2012

Page 22: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

real work [ˈrē(ə)l] [wərk]ADJECTIVE (and a NOUN) : : “this is where heavy lifting may be involved”"an SCCM admin should ensure that everything else is in place before starting the real work of creating awesome reports”

Page 23: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Microsoft Confidential

“I need you to create a report that shows….”

23

1. Does the data exist in the database? If not, can it/should it be added?

“Is it possible to get a list of all processes on clients?” “Uhm, yes, but….”

2. Does one of the 400+ reports included in CM2012 meet the requirement?

3. Is one of the included reports close and can be copied and modified to meet the requirement?

4.BING search for a report that someone else (product team, MVP, myITforum.com member, etc) created and shared. Likely you’ll find something close!

5.Create it!

Identify the views/RBAC functions that contain the data you will need

If you need help with the query, buy your SQL DBA a cup of coffee!

Page 24: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

DemoOverview of report structure

Page 25: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Creating the Report

Identify the views/functions that contain the data you need and perfect the query (queries) firstDon’t expect a report to make a ‘bad’ query betterUse parameters to make the report more user friendlyUse the included expressions for page count, date, report name, etcAdd images, color schemes, change fonts so it matches company branding

Spend 90% of your time here

Spend the rest here

Page 26: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

T-SQL Query Basics

The available views for CM2012 are documented on TechNet:

https://technet.microsoft.com/en-us/library/dn581978.aspx

A SQL query a colleague documented:http://blogs.technet.com/b/configmgr_geek_speak/archive/2013/04/05/configuration-manager-2012-sp1-all-inclusive-sql-database-views-listing.aspx

Most of the RBAC function/view names are fairly self-explanatory

Page 27: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Creating T-SQL QueriesQ1

SELECT * FROM V_GS_OPERATING_SYSTEM

Q2

SELECT CAPTION0 FROM V_GS_OPERATING_SYSTEM

Q3

SELECT CAPTION0 AS OS FROM V_GS_OPERATING_SYSTEM

Q4

SELECT CAPTION0 AS OS FROM V_GS_OPERATING_SYSTEM ORDER BY OS

Q5

SELECT CAPTION0 FROM V_GS_OPERATING_SYSTEM WHERE CAPTION0 LIKE '%server%'

That’s great, but what about the computer name?!

Page 28: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Creating T-SQL QueriesQ6

SELECT * FROM V_R_SYSTEM

Q7

SELECT * FROM V_GS_OPERATING_SYSTEM

Q8

SELECT v_R_System.Name0, v_GS_OPERATING_SYSTEM.Caption0

FROM v_R_System INNER JOIN v_GS_OPERATING_SYSTEM ON v_R_System.ResourceID = v_GS_OPERATING_SYSTEM.ResourceID

Page 29: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

DemoSome SQL query basics

Page 30: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

DemoBasic ReportList computer name with Installed Apps

Page 31: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

DemoBasic Report with parametersList computer name with Installed Apps

Page 32: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

DemoReport Manager

Page 33: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse

Evaluations: Please provide session feedback by clicking the EVAL button in the scheduler app (also download slides). One lucky winner will receive a free ticket to the next MMS!Session Title:

Discuss…

Ask your questions-real world answers!Plenty of time to engage, share knowledge.

SPO

NSO

RS

Page 34: Got Reports?Got Reports? Let me show you how in SCCM Santos Martinez @ConfigNinja  Brett Bennett @texasmcse