Wednesday, June 5, 2013

SCCM 2012 SRS Report - Server Hardware Info

So I haven't written anything in awhile.  Well not much at all, but this one was fun.

Our server team wanted a report of a bunch of config items on their hardware.  In 2007 this many joins would have made my head spin, let alone adding in Report Builder which I'm kinda new at.  So here was my process for developing my first SRSS Report.

First, open SQL Server Buisness Intelligence Development Studio (BIDS).  If you don't know what that is, well I just use it for the query builder that used to be in older version of SQL Management Studio.  Create a new project or overwrite an old one. 
  • In the Solution Explorer pane (cntr+alt+L) if it isn't on the upper right side of the screen, Right Click 'Shared Data Sources' --> Add Data Source, click Edit and fill in the information needed to access your database (I can't help you here).  Test the connection till it works, and click OK until you're out of all the pop-ups
  • Right Click Shared Datasets --> Add New DataSet in the Solution Explorer.  Give it a name and use the drop down to select the dataset you just created above if it's not already there. 
  • This is where I use the Query Designer.  In my case the design looked something like this (query below).


  • Once you have the data you want in the result pane, highlight everything in the SQL pane (the query), and copy it.  Now it's time to go to report builder.
  • Assuming you've got your reporting point all set up correctly, open your SCCM console and access Monitoring --> Reporting, Right Click Reports --> Create Report.  The Create Report wizard opens.
  • Select SQL-based Report, give it a name and description, server 'should' be filled in, and give it a path (folder under reports).  I called this Server Hardware Information and put it in Hardware - General.


  • Next, next, close.  Report Builder will open (I'm using 3.0)
  • Click "Table or Matrix"
  • Click Next to create a new Dataset (think Dataset = Query)
  • You 'should' already have a Data Source and can click next.  If not your Reporting Point has problems and that's outside the scope of this article.  If you get a Data-Source credentials pop-up use credentials that will let you read all views in your database and click OK.
  • On the Design a query window, click Edit as Text.  Now you can paste in the query you developed in BIDS.  Go ahead and run it just to make sure you get the dataset you're looking for then click Next.
  • Here's where the artform comes in.  Since I'm doing a very basic report, I just drag the server name in the 'Row Group' field and everything else in Values.  Maybe later I'll get tricky and put in some column groups.  Anyway put all your fields out there and click Next.
  • Since this is a basic report, I uncheck show subtotals/grand totals, and Expand/collaps groups.  Aaaaand, click next.
  • What is your favorite color?  Click Finish.
  • Now your report is build, give it a test run.  Here's what mine looks like (truncated)
  • Next I like the groups shaded.  Thanks to Paul at LINK for the following code.
  • Click empty space under your report when in design view.  In the properties pane you should see a Code section.  Clcik the ... and paste this in:

Private bOddRow As Boolean
'*************************************************************************
' -- Display green-bar type color banding in detail rows
' -- Call from BackGroundColor property of all detail row textboxes
' -- Set Toggle True for first item, False for others.
'*************************************************************************
Function AlternateColor(ByVal OddColor As String, _
         ByVal EvenColor As String, ByVal Toggle As Boolean) As String
    If Toggle Then bOddRow = Not bOddRow
    If bOddRow Then
        Return OddColor
    Else
        Return EvenColor
    End If
End Function

  • Now select the cell that your Row Grouping is set for ([Name] in my example).  In the Properties pane --> Fill --> Background color, hit the drop down and select 'Expression'.  Put this in the box (click OK after):
=Code.AlternateColor("White", "LightGrey", True)
  • Now select the rest of the data cells and paste the following into the background expression.
=Code.AlternateColor("LightGrey", "White", False)
  • Run it:


And wala, report.

--Dave

Oh yeah.  The query:

SELECT DISTINCT
v_R_System.Netbios_Name0 AS Name,
v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0 AS SITE,
v_GS_WORKSTATION_STATUS.LastHWScan AS HWScan,
v_GS_COMPUTER_SYSTEM.Manufacturer0 AS Manufacturer,
v_GS_COMPUTER_SYSTEM.Model0 AS Model,
v_GS_PC_BIOS.SerialNumber0 AS Serial,
v_GS_NETWORK_ADAPTER_CONFIGURATION.IPAddress0 AS IP,
v_R_System.Operating_System_Name_and0 AS OS,
v_GS_PROCESSOR.Name0 AS Processor,
v_GS_PROCESSOR.NumberOfCores0 AS Cores,
COUNT(v_GS_PROCESSOR.DeviceID0) AS NumProcs,
v_GS_OPERATING_SYSTEM.CSDVersion0 AS SP,
v_GS_X86_PC_MEMORY.TotalPhysicalMemory0 AS TotMemMB,
v_GS_LOGICAL_DISK.DeviceID0 AS Drive,
v_GS_LOGICAL_DISK.Size0 AS TotalGB,
v_GS_LOGICAL_DISK.FreeSpace0 AS FreeGB
FROM       
v_R_System INNER JOIN
v_RA_System_SMSAssignedSites ON v_R_System.ResourceID =
v_RA_System_SMSAssignedSites.ResourceID INNER JOIN

v_GS_LOGICAL_DISK ON v_R_System.ResourceID =
v_GS_LOGICAL_DISK.ResourceID INNER JOIN

v_GS_PC_BIOS ON v_R_System.ResourceID =
v_GS_PC_BIOS.ResourceID INNER JOIN

v_GS_WORKSTATION_STATUS ON v_R_System.ResourceID = v_GS_WORKSTATION_STATUS.ResourceID INNER JOIN

v_GS_COMPUTER_SYSTEM ON v_R_System.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID INNER JOIN
v_GS_X86_PC_MEMORY ON v_R_System.ResourceID =
v_GS_X86_PC_MEMORY.ResourceID INNER JOIN
v_GS_OPERATING_SYSTEM ON v_R_System.ResourceID = v_GS_OPERATING_SYSTEM.ResourceID INNER JOIN
v_GS_PROCESSOR ON v_R_System.ResourceID =
v_GS_PROCESSOR.ResourceID INNER JOIN
v_GS_NETWORK_ADAPTER_CONFIGURATION ON v_R_System.ResourceID = v_GS_NETWORK_ADAPTER_CONFIGURATION.ResourceID

WHERE    
(NOT (v_GS_LOGICAL_DISK.DriveType0 = '2')) AND
(NOT (v_GS_LOGICAL_DISK.DriveType0 = '5'))
GROUP BY v_R_System.Netbios_Name0,
v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0,
v_GS_WORKSTATION_STATUS.LastHWScan,
v_GS_COMPUTER_SYSTEM.Manufacturer0,
v_GS_COMPUTER_SYSTEM.Model0,
v_GS_PC_BIOS.SerialNumber0,
v_GS_NETWORK_ADAPTER_CONFIGURATION.IPAddress0,
v_R_System.Operating_System_Name_and0,
v_GS_PROCESSOR.Name0,
v_GS_PROCESSOR.NumberOfCores0,
v_GS_OPERATING_SYSTEM.CSDVersion0,
v_GS_X86_PC_MEMORY.TotalPhysicalMemory0,
v_GS_LOGICAL_DISK.DeviceID0,
v_GS_LOGICAL_DISK.Size0,
v_GS_LOGICAL_DISK.FreeSpace0
HAVING     
(v_R_System.Operating_System_Name_and0 LIKE N'%server%') AND
(v_GS_NETWORK_ADAPTER_CONFIGURATION.IPAddress0 IS NOT NULL)

Wednesday, February 27, 2013

Just a few updates missing

So typically when it comes to individual machines failing patches I get all grumpy and just tell the first touch guys to PXE image the pig.  My theory is that if there is something wrong enough that a machine won't patch there is usually 5 other things wrong that will get ugly later on down the road.

In this case most patches installed, but 4 were failing.  Odd, SCCM is obviously working, and the system had just been imaged a week ago.  Permissions were set right so I don't 'think' anyone got to tinkering with the box.  What the heck.

So first I tried out normal WMI and SCCM Repair proceedures.  No change.  Looked through the event logs, nothing stood out.  Went through the execmgr log and I see if failed with a 0x80073712 code. 

Never seen that before.  To my best friend Google: "What is 0x80073712"?  Which is also how you probably got here.

To fix, use the System Update Readiness Tool and perhaps SFC.exe /scannow
SURT: http://windows.microsoft.com/en-US/windows7/What-is-the-System-Update-Readiness-Tool
           http://www.zdnet.com/blog/bott/microsoft-notes-windows-update-inconsistencies-provides-fix/3044
           NOTE: The above also mentions error codes 800706BE and 8024200D
SFC:   http://support.microsoft.com/kb/185836

For some more background, 0x80073712 [ERROR_SXS_COMPONENT_STORE_CORRUPT] means that there are some inconsistencies or corruption in the winsxs folder.  For information on winsxs see here: http://www.winvistaclub.com/f16.html

Along the way I can up with the following tips but didn't use them:
  net stop wuauserv
  cd %systemroot%\SoftwareDistribution
  ren SoftwareDistribution SoftwareDistribution.old
  net start wuauserv
  Download update manually, and attempt to install form download.

and
How to reset Window Update: http://support.microsoft.com/kb/971058

Example of my WindowsUpdate.log
2013-02-25 09:45:03:332 7276 6a4 Handler CBS package identity: Package_for_KB2753842~31bf3856ad364e35~amd64~~6.1.2.0
2013-02-25 09:45:03:351 7276 6a4 Handler Installing self-contained with source=C:\Windows\SoftwareDistribution\Download\908a0e5d76fa13f541dce8ccd1e16264\windows6.1-kb2753842-v2-x64.cab, workingdir=C:\Windows\SoftwareDistribution\Download\908a0e5d76fa13f541dce8ccd1e16264\inst
2013-02-25 09:45:07:190 7276 40c Handler FATAL: CBS called Error with 0x80073712,
2013-02-25 09:45:07:880 7276 6a4 Handler FATAL: Completed install of CBS update with type=0, requiresReboot=0, installerError=1, hr=0x80073712

Example of CBS.log
Well, when it finally worked it overwrote my CBS.log, so I don't have an example...   But this is where I connected the 0x80073712 with the verbiage ERROR_SXS_COMPONENT_STORE_CORRUPT.