Thursday, September 26, 2013

Fix: WMI repository reset failed

Fixing WMI issues can be quite a pain as we all know :)
There is another WMI issue which I have encountered recently on Windows 7 and fixed which I thought
should be shared with all.

Usually for WMI issues in Windows 7, the last resort to resolve the issue would be to reset the
repository using winmgmt /resetrepository

But what if even this last resort fails you?
The error that I have gotten attempting to fix this client is as below

C:\Users\vincent.goh.adm>Winmgmt /resetrepository
WMI repository reset failed
Error code:     0x8007041B
Facility:       Win32
Description:    A stop control has been sent to a service that other running ser
vices are dependent on.

To resolve this, you can follow the below procedure

1)      Adding Network service to Local Administrator
2)    Navigate to the key below and confirm if the Value is "Both". If its is not, go ahead to change it to Both
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{F3130CDB-AA52-4C3A-AB32-85FFC23AF9C1}\InprocServer32\ThreadingModel]

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{F3130CDB-AA52-4C3A-AB32-85FFC23AF9C1}\InprocServer32
Value Name: ThreadingModel
Value Type: REG_SZ
Correct Value Data: Both
 3)      Then restart the WMI services in services.msc.

Tuesday, September 17, 2013

SCCM Patch Compliance Report for Machines by Wildcard

As an add on to a previous post I had for the patch compliance, the below query is to do the same thing but that it will allow you to list the all machines that you require information as well as using a wildcard (i.e for machine name starting with ABC change the wildcard underlined to 'ABC%')

select
   VRS.Name0,
   catinfo2.CategoryInstanceName as UpdateClassification,
            ui.BulletinID as BulletinID,
            ui.DatePosted,
   ui.DateRevised,        
            ui.ArticleID as ArticleID,
            ui.Title as Title,        
   ui.InfoURL as InformationURL
from v_UpdateComplianceStatus css
left join v_R_System VRS on VRS.ResourceID = css.ResourceID
join v_UpdateInfo ui on ui.CI_ID=css.CI_ID
join v_CICategories_All catall on catall.CI_ID=ui.CI_ID
join v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company'
join v_CICategories_All catall2 on catall2.CI_ID=ui.CI_ID
join v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName='UpdateClassification'
left join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = VRS.ResourceID
left join (
                        select atc.CI_ID, Deadline=min(a.EnforcementDeadline) from v_CIAssignment a
                        join v_CIAssignmentToCI atc on atc.AssignmentID=a.AssignmentID
                        group by atc.CI_ID) cdl   on cdl.CI_ID=css.CI_ID

where vrs.Active0 = 1and css.Status=2 and VRS.Name0 like '%'
order by VRS.name0 ,catinfo.CategoryInstanceName, catinfo2.CategoryInstanceName, ui.ArticleID

Friday, September 6, 2013

SCCM Patch Compliance - Listing required outstanding patches by server

The below query will enable you to get the patches that are required but has yet to be installed by server.
Replace the parameter @machinename with the server that you are referencing against.

declare @RscID int;
select @RscID=ResourceID from v_R_System where ((Name0 = @machinename) and (Active0 = 1));

select
catinfo2.CategoryInstanceName as UpdateClassification,
            ui.BulletinID as BulletinID,
            ui.DatePosted,
ui.DateRevised,        
            ui.ArticleID as ArticleID,
            ui.Title as Title,          
ui.InfoURL as InformationURL
from v_UpdateComplianceStatus css
join v_UpdateInfo ui on ui.CI_ID=css.CI_ID
join v_CICategories_All catall on catall.CI_ID=ui.CI_ID
join v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company'
join v_CICategories_All catall2 on catall2.CI_ID=ui.CI_ID
join v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName='UpdateClassification'
left join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = @RscID
left join (
                        select atc.CI_ID, Deadline=min(a.EnforcementDeadline) from v_CIAssignment a
                        join v_CIAssignmentToCI atc on atc.AssignmentID=a.AssignmentID
                        group by atc.CI_ID) cdl   on cdl.CI_ID=css.CI_ID
where  css.ResourceID = @RscID
and ((css.Status=2) )
order by catinfo.CategoryInstanceName, catinfo2.CategoryInstanceName, ui.ArticleID

Output of the report will be in the format as below when performed via SSRS