Eswar Koneti's Blog

All about Configmgr and its connected objects…….

  • About Author
      View eswar koneti's LinkedIn profile
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 106 other subscribers

  • Awards


  • FaceBook Updates

  • Catagories

  • Meta

  • Copyright!

    All the blog posts in this website are owned by Eswar Koneti and may not be reused in any mode without prior approval of Eswar Koneti. You may quote one paragraph from the blog posts if you link to the original blog post.
    Happy Reading!

Another Patch statistics report for SCCM 2007

Posted by Eswar Koneti on 16th May 2011

Here is another patch statistics report for SCCM 2007 environment with summary of patches that are deployed within month (30 days) with different column.

select ‘Total number of active patches within 30days:’, COUNT(distinct Title) AS ‘Count’
FROM v_GS_PatchStatusEx
WHERE (DATEDIFF(Day, LastStatusTime, GETDATE())) <=30
UNION
select ‘Percent sucessfully installed’, round(100.0*COUNT( case when LastState=107 or LastState=105 then ResourceID else NULL end)/COUNT(ResourceID),1) as ‘Procent succesful’ 
FROM v_GS_PatchStatusEx
WHERE (DATEDIFF(Day, LastStatusTime, GETDATE())) <=30

select ps.ID, ps.QNumbers, ps.Title,
    round(100.0*COUNT(distinct case when ps.LastState=107 or ps.LastState=105 then ps.ResourceID else NULL end)/COUNT(distinct ps.ResourceID),1) as ‘Procent succesful’ ,
       COUNT(distinct case when ps.LastState=107 or ps.LastState=105 then ps.ResourceID else NULL end) as ‘Distribution Successful’,
       COUNT(distinct case when ps.LastState=101 then ps.ResourceID else NULL end) as ‘Distribution Failed’,
       COUNT(distinct case when ps.LastState not in (107,105,101) then ps.ResourceID else NULL end) as ‘Distribution Incomplete’,
       COUNT(distinct ps.ResourceID) as ‘In Distribution Scope’,
‘SMS00001′ as ‘CollectionID’,
‘Microsoft Update’ as ‘Type’,
inf.InfoPath
from v_GS_PatchStatusEx ps
join v_FullCollectionMembership fcm on ps.ResourceID=fcm.ResourceID
join v_ApplicableUpdatesSummaryEx inf on
  ps.UpdateID=inf.UpdateID
where fcm.CollectionID= ‘SMS00001′ and
         inf.Type = ‘Microsoft Update’
         
 AND (DATEDIFF(Day, ps.LastStatusTime, GETDATE())) <=30     
group by ps.ID, ps.QNumbers, ps.Title, inf.InfoPath

Tags: , , , , , , , , , , , , , , , , ,
Posted in Patch Reports, SCCM 2007, SCCM Reports, Software Updates, SQL Quiries, WSUS | No Comments »

Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manner

Posted by Eswar Koneti on 25th March 2010

Long back created a report for the monthly Patch statistics which can be found in http://www.windows-noob.com/forums/index.php?/topic/1764-patch-management-report-in-sms-2003/#entry6281

Below all the reports have been created using the last state messages.Even you can create different type of quiries based on this.

patch status Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manner

I was referring to the Patch process and found an image which gives the statistics for the listed patches in a good viewable way.so thought of creating such a report and can be linked to other report to get preferable colums which are necessary.May be i can show it to the management team for the patch activity on monthly basis.This basically requries to create 3 reports( like 1,2,3 ) out of which 3 is linked to 2 and 2 is linked 1.It is just simple that you can run only one report which is linked to other reports which gives u a report like below for the given bulletin ID’s.

Note:The below report is filterd with language swedish,if you want to get status for English/other language patches,you can customise it.The below report is called 1)Patch Management summary

 Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manner

To Build this report and to link to other reports ,you will have to create 3 reports which i named it like :1)Patch Management summary 2)Status of Each bulletin ID 3)Status of each bulletin ID with distribution status

Create new reports for each with the below query.

3)Status of particular bulletin ID with selected distribution status:

select distinct sys.Netbios_Name0, sys.User_Domain0, sys.User_Name0, fcm.SiteCode, ws.LastHWScan,
DATEADD(ss,@__timezoneoffset,ps.LastStatusTime) as LastStatusTime, PSX.TimeApplied0,ps.LastStatusMessageIDName, ps.LastExecutionResult
from v_R_System sys
join v_FullCollectionMembership fcm on sys.ResourceID=fcm.ResourceID
join v_GS_WORKSTATION_STATUS ws on sys.ResourceID=ws.ResourceID
join v_GS_PatchStatusEx ps on sys.ResourceID=ps.ResourceID
join v_GS_PATCHSTATEEX PSX on PSX.ResourceID=ps.ResourceID
join v_ApplicableUpdatesSummaryEx summ on
       ps.UpdateID=summ.UpdateID
where (ps.LastStateName=@status and summ.ID=@Title) and
(summ.Type = ‘Microsoft Update’) and (summ.product NOT LIKE ‘Windows Server 2003′)
group by Netbios_Name0, user_Domain0,user_Name0,SiteCode,LastHWScan,LastStatusTime,LastStatusMessageIDName,TimeApplied0,LastExecutionResult
order by Netbios_Name0

Click on the “Prompts Button
Create a new prompt with the following Name: “status
Give it a prompt text for ex: Select the Status
 Provide the following sql statement to the prompt for status with the given syntax

  select distinct LastStateName from v_GS_PatchStatusEx

Create another prompt value for Title with the sytax query :

  Select Title,ID,Product from v_GS_PatchStatusEx

Create report 2 called Status of Each bulletin ID

declare @n float

select @n = count(distinct ps.ResourceID)
from v_GS_PatchStatusEx ps
join v_FullCollectionMembership fcm on ps.ResourceID=fcm.ResourceID
join v_ApplicableUpdatesSummaryEx summ on
       ps.UpdateID=summ.UpdateID
where (
ps.ID=@Title or ps.QNumbers=@Title or ps.Title=@Title) and
       (summ.Type =’Microsoft update’) and (summ.product NOT LIKE ‘Windows Server 2003′)

if IsNULL(@n,0) = 0 return

select @Title as Title, ps.LastStateName, count(distinct ps.ResourceID) as ‘Totals’,
 ROUND(100.0 * count(distinct ps.ResourceID)/@n,2) as ‘Percentage %’

from v_GS_PatchStatusEx ps
join v_FullCollectionMembership fcm on ps.ResourceID=fcm.ResourceID
join v_ApplicableUpdatesSummaryEx summ on ps.UpdateID=summ.UpdateID
where (
ps.ID=@Title or ps.QNumbers=@Title or ps.Title=@Title)
       and (summ.Type = ‘Microsoft update’ ) and (summ.product NOT LIKE ‘Windows Server 2003′)
group by ps.LastStateName

Prompt for Title:   select Title,ID,QNumbers from v_GS_PatchStatusEx

Once you create the report,just right click on the report  and choose properties ,Choose the “Links” tab , Choose link Type: “link to another report“choose the report the one which you created above(report 3 in this case). make sure you have selected the correct columns which are marked in red circle

patch 2 Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manneralmost we come to an end by creating last report called  1) Patch Management summary

select summ.ID,summ.QNumbers as ‘Q Number’,
COUNT(distinct ps.ResourceID) as ‘Requested’,
COUNT(distinct case when ps.LastState=107 or ps.laststate=102 or ps.laststate=105 then ps.ResourceID else NULL End)  as ‘Installed’,
ROUND(100.0*COUNT(distinct case when ps.LastState=107 or ps.laststate=102 or ps.laststate=105 then ps.ResourceID else NULL End) /count(distinct ps.ResourceID),2) as ‘Success %’
from v_GS_PatchStatusEx ps
join v_ApplicableUpdatesSummaryEx summ on ps.UpdateID=summ.UpdateID
where (summ.ID=’MS10-006′ or summ.ID=’MS10-007′ or summ.ID=’MS10-008′ or summ.ID=’MS10-013′) and (summ.Type=’Microsoft Update’) and (summ.product NOT LIKE ‘Windows Server 2003′) and (summ.language=’Swedish’)
group by summ.ID,summ.QNumbers
order by summ.ID

If you want to get the information from particular collection,then you can limit the Above report on a specified collection ,here is the one to go.

select summ.ID,summ.QNumbers as ‘Q Number’,
COUNT(distinct ps.ResourceID) as ‘Requested’,
COUNT(distinct case when ps.LastState=107 or ps.laststate=102 or ps.laststate=105 then ps.ResourceID else NULL End)  as ‘Installed’,
 ROUND(100.0*COUNT(distinct case when ps.LastState=107 or ps.laststate=102 or ps.laststate=105 then ps.ResourceID else NULL End)
 /count(distinct ps.ResourceID),2) as ‘Success %’
 from v_GS_PatchStatusEx ps
JOIN v_FullCollectionMembership fcm on ps.ResourceID=fcm.ResourceID
join v_ApplicableUpdatesSummaryEx summ on
   ps.UpdateID=summ.UpdateID
    where (summ.QNumbers=’975562′ or summ.QNumbers=’978695′ or summ.QNumbers=’979482′ or summ.QNumbers=’980195′ or summ.QNumbers=’982381′) and
            (summ.Type=’Microsoft Update’) and (summ.product NOT LIKE ‘Windows Server 2003′) and(fcm.CollectionID
=@collID)
group by summ.ID,summ.QNumbers

order by summ.ID

You would need to create promot collId given below:

begin
 if (@__filterwildcard = ”)
  select CollectionID, Name from v_Collection order by Name
 else
  select CollectionID, Name from v_Collection
  WHERE CollectionID like @__filterwildcard
  order by Name
end
The above report will generate status for specific bulletin ID’s for swedish language in brief.If you want to generate report for other languages or you want to get patch status irrespective of Laguage,you can simply delete it.

Once you create this report,right click and select properties.Choose the “Links” tab,Choose link Type: “link to another report” ,choose the report that you have created above(report 2 inthis case).ensure you have the correct columns fields like below otherwise you will mislead the report.

 patch 3 Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manneryou have done now,reports are ready for you.

 Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manner

Report for Particular Bulletin ID ,click on MS10-007

 Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manner

click on failed status,which gives you all machines

 Monthly Patch statistics reports in SMS/SCCM to show up to the management in a simplified manner

Hope it helps you insome way.The same reports are still work in SCCM in similar way but before doing it SCCM,change the bulletin ID numbers and language(in mycase it is Swedish)

Note: when you copy and paste the quiries to your SMS/SCCM server ,you might see some errors because of copy and paste.All these quiries are present in notepad attached here  Status report quiries

All the reports are working well in SCCM environment but you will have to remove a part of syntax called “and (summ.product NOT LIKE ‘Windows Server 2003′)” from the reports which you use since in SCCM,the product value is NULL.If you use the above quiries without modifying,you may see blank report.

Tags: , , , , , , , , , , , , , , , , ,
Posted in Patch Reports, SCCM 2007, SCCM Reports, Software Updates, SQL Quiries, WSUS | 44 Comments »

Patch Status Compliance(software updates) report in SMS /SCCM

Posted by Eswar Koneti on 16th October 2009

Are you looking for getting a report for a given KB numbers or MSID(like MS10-087),you can add few more lines to the existing code as like below and change the ID1 to ID2 also add a prompt to it.The same report is also applicable in SCCM but it doesn’t give some columns though it has required information.

SMS 2003 Patch Status report for given list of Specific MS ID, Q Number, title:

select summ.Product, summ.LocaleID, summ.Language,

COUNT(distinct case when ps.LastState=107 or ps.LastState=105  then ps.ResourceID else NULL end) as ‘Distribution Successful’,

COUNT(distinct case when ps.LastState=102 then ps.ResourceID else NULL end) as ‘Reboot Pending’,

COUNT(distinct case when ps.LastState=101 then ps.ResourceID else NULL end) as ‘Distribution Failed’,

COUNT(distinct case when ps.LastState not in (107,105,101,102) then ps.ResourceID else NULL end) as ‘Distribution Incomplete’,

COUNT(distinct ps.ResourceID) as ‘In Distribution Scope’,

ROUND(100.0*COUNT(distinct case when ps.LastState=107 or ps.laststate=102 or ps.laststate=105 then ps.ResourceID else NULL end)/count(distinct ps.ResourceID),2) as ‘Success %’,

ROUND(100.0*COUNT(distinct case when ps.laststate=101 then ps.ResourceID else NULL end)/count(distinct ps.ResourceID),2) as ‘failed %’,

ROUND(100.0*COUNT(distinct case when ps.LastState not in (107,105,101,102) then ps.ResourceID else NULL end)/count(distinct ps.ResourceID),2) as ‘Incomplete%’

from v_GS_PatchStatusEx ps

join v_ApplicableUpdatesSummaryEx summ on

   ps.UpdateID=summ.UpdateID

    where (summ.ID=@ID or summ.QNumbers=@ID or summ.Title=@ID) and

            summ.Type=’Microsoft Update’

group by summ.Product, summ.LocaleID, summ.Language

order by summ.Product,  summ.LocaleID, summ.Language

Prompt:

begin
if (@__filterwildcard = ”)
  select distinct Title, ID, QNumbers,Type from v_ApplicableUpdatesSummaryEx order by Title
else
  select distinct Title, ID, QNumbers, Type from v_ApplicableUpdatesSummaryEx
  WHERE Title like @__filterwildcard
  order by Title
end

Patch compliance Progress report in SCCM:

This report will gives you more information about the SCCM clients displays how many patches are needed more to be installed on this since it does the scan agent with your SCCM server(WUAhandler.log).By default i have provided to query from All systems ,if you need to have it from specific collection,you may add prompt for asking collection ID or  Name also.

select  CS.Name0, CS.UserName0,
case
when (sum(case when UCS.status=2 then 1 else 0 end))>0 then (‘Needs ‘+(cast(sum(case when UCS.status=2 then 1 else 0 end)as varchar(10))+ ‘ Patches’))

else ‘Good Client’

end as ‘Status’,

      ws.lasthwscan as ‘Last HW scan’,

      FCM.collectionID–,

from v_UpdateComplianceStatus UCS

left outer join dbo.v_GS_COMPUTER_SYSTEM  CS on CS.ResourceID = UCS.ResourceID

join v_CICategories_All catall2 on catall2.CI_ID=UCS.CI_ID

join v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName=’UpdateClassification’

left join v_gs_workstation_status ws on ws.resourceid=CS.resourceid

left join v_fullcollectionmembership FCM on FCM.resourceid=CS.resourceid

Where UCS.Status = ’2′

and FCM.collectionid = ‘SMS00001′

Group by CS.Name0,CS.UserName0,ws.lasthwscan,FCM.collectionID

Order by CS.Name0,CS.UserName0,ws.lasthwscan,FCM.collectionID

Hope it helps you.

Tags: , , , , , , , , , , , , , , , , ,
Posted in Patch Reports, SCCM 2007, SCCM Reports, Software Updates, SQL Quiries, WSUS | 2 Comments »

Report for Software Update Compliance

Posted by Eswar Koneti on 25th September 2009

I was searching for something to find the software update complaince to see if machines requires something to patch .as i couldnt find any such report from default reports ,so created one like below and gives me the compelet complaicne of software updates.

SQL Statement

select distinct
   sys.Name0,
   ui.BulletinID as BulletinID,
   ui.ArticleID as ArticleID,
   ui.Title as Title
from v_UpdateComplianceStatus css
join v_UpdateInfo ui on ui.CI_ID=css.CI_ID
join v_R_System sys on css.ResourceID=sys.ResourceID
join v_ClientCollectionMembers ccm on ccm.ResourceID=sys.ResourceID
where  css.Status=2 and
ccm.CollectionID=@CollID
order by sys.Name0, ui.ArticleID

Prompts

Name: CollID
Prompt text: Collection ID
Provide a SQL statement:
begin
 if (@__filterwildcard = ”)
  select CollectionID as CollectionID, Name as CollectionName from v_Collection order by Name
 else
  select CollectionID as CollectionID, Name as CollectionName from v_Collection
  WHERE CollectionID like @__filterwildcard or Name like @__filterwildcard
  order by Name
end

Tags: , , , , , , , , , , , , , , , , ,
Posted in Patch Reports, SCCM 2007, SCCM Reports, Software Updates, SQL Quiries, WSUS | No Comments »