Queries

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

Patch status for SUG:

Declare @DeploymentName as Varchar(255)

Set @DeploymentName = 'SUM_WRK_SQL_Production_Lush-Automatic'

select

vrs.Name0,

vrs.Active0,

vrs.AD_Site_Name0,

vrs.User_Name0,

vrs.Operating_System_Name_and0,

a.Assignment_UniqueID as DeploymentID,

a.AssignmentName as DeploymentName,

a.StartTime as Available,

a.EnforcementDeadline as Deadline,

sn.StateName as LastEnforcementState,

wsus.LastErrorCode as LasErrorCode,

wsus.LastScanTime as LastWSUSScan,

DateDiff(D, wsus.LastScanTime, GetDate()) as LastWSUSScan,

wks.LastHWScan,

DateDiff(D, wks.LastHwScan, GetDate()) as LastHWScan

from v_CIAssignment a

join v_AssignmentState_Combined assc on a.AssignmentID=assc.AssignmentID

join v_StateNames sn on assc.StateType = sn.TopicType and


sn.StateID=isnull(assc.StateID,0)

join v_R_System vrs on vrs.ResourceID = assc.ResourceID

join v_GS_WORKSTATION_STATUS wks on wks.ResourceID = assc.ResourceID

join v_UpdateScanStatus wsus on wsus.ResourceID = assc.ResourceID

where a.AssignmentName = @DeploymentName

and assc.StateType in (300,301)

order by 11 desc
Last Patch Details:

Select name0 AS [Machine Name], sys.User_Name0, ui.Title AS [Patch Title],


(CASE ucs.status WHEN 2 THEN 'Required' WHEN 1 THEN 'NOT REQUIRED' WHEN 0
THEN 'INSTALL STATE UNKNOWN' WHEN 3 THEN 'Installed' END) AS [Install
Status] , dbo.v_AuthListInfo.Title as [Update Group],

ui.ArticleID, (CASE UI.IsExpired WHEN 0 THEN 'NOT EXPIRED' WHEN 1 THEN


'EXPIRED' END) AS [EXPIRY], (CASE UI.IsSuperseded WHEN 0 THEN 'NOT
Superseded' WHEN 1 THEN 'Superseded' END) AS [SEPERSEDENCE] , (CASE
ui.Severity WHEN 0 then 'none' when 2 then 'low' WHEN 6 then 'MODERATE' WHEN
8 THEN 'IMPORTANT' WHEN 10 THEN 'CRITICAL' END) AS [SEVERITY] ,
ui.DatePosted AS DateReleased, ucs.LastStatusChangeTime AS DateInstalled

FROM dbo.v_ClientCollectionMembers INNER JOIN

dbo.v_R_System AS sys ON dbo.v_ClientCollectionMembers.ResourceID =


sys.ResourceID LEFT OUTER JOIN

dbo.v_CIRelation INNER JOIN

dbo.v_UpdateInfo AS ui INNER JOIN

dbo.v_UpdateComplianceStatus AS ucs ON ui.CI_ID = ucs.CI_ID ON


dbo.v_CIRelation.ToCIID = ui.CI_ID INNER JOIN

dbo.v_AuthListInfo ON dbo.v_CIRelation.FromCIID = dbo.v_AuthListInfo.CI_ID


ON sys.ResourceID = ucs.ResourceID

GROUP BY sys.Name0, ui.IsExpired, UI.IsSuperseded, ucs.status, ui.Severity,


dbo.v_AuthListInfo.Title, dbo.v_ClientCollectionMembers.CollectionID,
sys.User_Name0, ui.ArticleID, ui.Title, ui.DatePosted ,
ucs.LastStatusChangeTime

HAVING (ui.IsExpired = 0) AND

(dbo.v_AuthListInfo.Title like 'Name of SUG') AND


(dbo.v_ClientCollectionMembers.CollectionID like 'collectionID')

ORDER BY sys.Name0
All SUG:
select
a.AssignmentName as 'Deployment Name',
ugi.Title as 'SUG Name',
a.CollectionName as 'Collection Name',
a.CollectionID as 'Collection ID',
a.StartTime as Available,
a.EnforcementDeadline as Deadline,
a.Assignment_UniqueID as DeploymentID,
a.LastModificationTime as LastModificationTime
from v_CIAssignmentToGroup atg
join v_AuthListInfo ugi on ugi.CI_ID=atg.AssignedUpdateGroup
join v_CIAssignment a on a.AssignmentID=atg.AssignmentID
order by a.AssignmentName

Patches required but not deployed:

DECLARE @collectionName nvarchar(100)


DECLARE @LastMonth DATE
DECLARE @ThirdTuesday DATE

SELECT @LastMonth = DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE())-1, 0)


SELECT @ThirdTuesday = CAST(dateadd(day, ((17 - datepart(dw,@LastMonth) ) % 7 ) + 14,
@LastMonth) as Date)

SELECT
rs.Netbios_name0 AS 'PC Name',
Ui.BulletinID,
Ui.ArticleID,
Ui.title,
Ui.InfoURL,
cast(Ui.DateRevised as Date) DateRevised,
CASE
WHEN os.CSDVersion0 IS NULL THEN os.caption0
WHEN os.caption0 IS NULL THEN 'N/A'
ELSE os.caption0 + ' - ' + os.CSDVersion0
END AS OS

FROM
v_ClientCollectionMembers ccm
LEFT JOIN v_R_System rs on rs.ResourceID = ccm.ResourceID
LEFT JOIN v_UpdateComplianceStatus UCS on UCS.ResourceID = ccm.ResourceID
JOIN v_UpdateInfo ui on ui.CI_ID=UCS.CI_ID
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'
INNER JOIN v_gs_workstation_status ws on ws.resourceid=rs.resourceid
JOIN v_Gs_Operating_System OS on ws.resourceid = OS.ResourceID
LEFT OUTER JOIN v_CITargetedMachines ctm on ctm.CI_ID=UCS.CI_ID and ctm.ResourceID
= rs.ResourceID

WHERE
ccm.CollectionID = 'BGE00171'
AND
catinfo2.CategoryInstanceName IN ('Critical Updates','Security Updates','Service
Packs','Updates','Update Rollups')
AND ((UCS.Status = 2 AND ui.DateRevised < @ThirdTuesday) OR (ctm.ResourceID IS
NOT NULL AND UCS.Status <> 3 AND ui.DateRevised < @ThirdTuesday))
AND ui.CustomSeverity = 0
AND (ui.BulletinID like '' OR ui.BulletinID like 'MS%')
AND (ui.IsExpired = 0 OR (IsExpired != 0 AND ucs.Status = 3))
AND (ui.IsSuperseded = 0 OR (IsSuperseded != 0 AND ucs.Status = 3))
ORDER BY [PC Name], DateRevised asc

All Active deployments:-

SELECT DISTINCT app.DisplayName AS 'Application Name',

aa.CollectionName AS 'Deployed to Collection',

aa.CollectionID,v_ContentInfo.ContentSource

FROM dbo.fn_ListDeploymentTypeCIs(1033) AS dt

inner join dbo.fn_ListLatestApplicationCIs(1033) AS app ON dt.AppModelName = app.ModelName

left outer join v_AppDeploymentSummary ads on app.CI_ID = ads.CI_ID

left outer join v_ApplicationAssignment aa on ads.AssignmentID = aa.AssignmentID

left outer join v_ContentInfo on DT.CONTENTID = V_CONTENTINFO.CONTENT_UNIQUEID

where aa.CollectionName not like '%NULL%'

Order by [Application Name];

All Deployment details:-

SELECT DISTINCT app.DisplayName AS 'Application Name', aa.CollectionName AS 'Deployed to


Collection', "Status" =

case

when app.IsExpired = '1' then 'Retired'

when app.IsExpired = '0' then 'Active'

end, ads.DeploymentTime AS 'Date created'

FROM dbo.fn_ListDeploymentTypeCIs(1033) AS dt
inner join dbo.fn_ListLatestApplicationCIs(1033) AS app ON dt.AppModelName = app.ModelName

left outer join v_AppDeploymentSummary ads on app.CI_ID = ads.CI_ID

left outer join v_ApplicationAssignment aa on ads.AssignmentID = aa.AssignmentID

Order by [Application Name];

Applications Referenced in TS:-


select app.DisplayName [Application],TS.Name [TS Name],TS.Description [TSDescription]
From dbo.fn_ListLatestApplicationCIs(1033) app
inner join v_TaskSequenceAppReferencesInfo TSApp on app.ModelName=TSApp.RefAppModelName
inner join v_TaskSequencePackage TS on TS.PackageID=TSApp.PackageID
order by [Application]

Applications with No Deployments:-


select
apps.DisplayName as 'ApplicationName',
apps.Softwareversion as 'Version',
pkg.PackageID,
CASE pkg.PackageType
WHEN 0 THEN 'Package'
WHEN 3 THEN 'Driver'
WHEN 4 THEN 'TaskSequence'
WHEN 5 THEN 'SoftwareUpdate'
WHEN 6 THEN 'DeviceSettings'
WHEN 7 THEN 'Virtual'
WHEN 8 THEN 'Application'
WHEN 257 THEN 'Image'
WHEN 258 THEN 'BootImage'
WHEN 259 THEN 'OSInstall'
END AS 'PackageType',
apps.NumberOfDeploymentTypes as 'NoofDT',
apps.NumberOfDeployments,
apps.NumberOfDependentTs
from fn_ListLatestApplicationCIs(1033) apps
left join v_TaskSequencePackageReferences tspr on tspr.ObjectID = apps.ModelName
left join vSMS_ApplicationAssignment ass on ass.AssignedCI_UniqueID = apps.CI_UniqueID
left join v_Package pkg on pkg.SecurityKey = apps.ModelName
where
PackageType = 8
and apps.IsLatest=1
and ass.AssignmentName IS NULL
and tspr.PackageID IS NULL
and apps.NumberOfDeployments = 0
and apps.NumberOfDependentTs = 0
and apps.IsLatest=1
order by apps.DisplayName

applications with Deployments:-


Select
Pac.PackageID as 'App_ID',
col.CollectionID as 'AppCollection_ID',
Vaa.ApplicationName as 'ApplicationName',
Ds.CollectionName as 'CollectionName',
CASE when col.CollectionType = 1 Then 'User' when col.CollectionType = 2 Then 'Device'
Else 'Others' End as 'CollType',
CASE when Vaa.DesiredConfigType = 1 Then 'Install' when vaa.DesiredConfigType = 2 Then
'Uninstall’' Else 'Others' End as 'DeploymentType',
CASE when Ds.DeploymentIntent = 1 Then 'Required' when Ds.DeploymentIntent = 2
Then 'Available' when Ds.DeploymentIntent = 3 Then 'Simulate' End as 'Purpose',
Ds.DeploymentTime as 'AvailableTime',
Ds.EnforcementDeadline as 'RequiredTime',
Vaa.CreationTime as 'CreatedOn',
Vaa.LastModificationTime as 'LastModifiedOn',
Vaa.LastModifiedBy as 'LastModifiedBy'
from v_DeploymentSummary Ds
left join v_ApplicationAssignment Vaa on Ds.AssignmentID = Vaa.AssignmentID
left join v_Package Pac on Vaa.ApplicationName = Pac.Name
left join v_collection col on Ds.CollectionName = col.Name
Where Ds.FeatureType = 1
order by Ds.DeploymentTime desc

APP Report Using Application name:-

select distinct
vrs.user_name0,fn.machinename,fn.applicationname,fn.deploymenttypename,fn.Enforcementtime,erro
rcode,

case when fn.appstate='1000' then 'Success'

when fn.appstate='1001' then 'Already Compliant'

when fn.appstate='1002' then 'Simulate Success'

when fn.appstate='2000' then 'In progress'

when fn.appstate='2001' then 'Waiting for content'

when fn.appstate='2002' then 'Installing'

when fn.appstate='2003' then 'Restart to continue'

when fn.appstate='2004' then 'Waiting for maintenance window'

when fn.appstate='2005' then 'Waiting for schedule'

when fn.appstate='2006' then 'Downloading dependent content'

when fn.appstate='2007' then 'Installing dependent content'

when fn.appstate='2008' then 'Restart to complete'

when fn.appstate='2009' then 'Content downloaded'


when fn.appstate='2010' then 'Waiting for update'

when fn.appstate='2011' then 'Waiting for user session reconnect'

when fn.appstate='2012' then 'Waiting for user logoff'

when fn.appstate='2013' then 'Waiting for user logon'

when fn.appstate='2014' then 'Waiting To Install'

when fn.appstate='2015' then 'Waiting Retry'

when fn.appstate='2016' then 'Waiting For Presentation Mode'

when fn.appstate='2017' then 'Waiting For Orchestration'

when fn.appstate='2018' then 'Waiting For Network'

when fn.appstate='2019' then 'Pending App-V Virtual Environment Update'

when fn.appstate='2020' then 'Updating App-V Virtual Environment'

when fn.appstate='3000' then 'Requirements not met'

when fn.appstate='3001' then 'Host Platform Not Applicable'

when fn.appstate='4000' then 'Unknown'

when fn.appstate='5000' then 'Deployment failed'

when fn.appstate='5001' then 'Evaluation failed'

when fn.appstate='5002' then 'Deployment failed'

when fn.appstate='5003' then 'Failed to locate content'

when fn.appstate='5004' then 'Dependency installation failed'

when fn.appstate='5005' then 'Failed to download dependent content'

when fn.appstate='5006' then 'Conflicts with another application deployment'

when fn.appstate='5007' then 'Waiting Retry'

when fn.appstate='5008' then 'Failed to uninstall superseded deployment type'

when fn.appstate='5009' then 'Failed to download superseded deployment type'

when fn.appstate='5010' then 'Failed to updating App-V Virtual Environment'

end as 'Laststatusmessage'

from fn_AppDTClientSummarizedState('') fn join v_r_system vrs on vrs.name0=fn.machinename


where fn.applicationname like '%%'

APP Report Using Assignment ID:-

select

aa.CollectionName,

aa.ApplicationName,

Vrs.Name0,

case when ae.AppEnforcementState = 1000 then 'Success'

when ae.AppEnforcementState = 1001 then 'Already Compliant'

when ae.AppEnforcementState = 1002 then 'Simulate Success'

when ae.AppEnforcementState = 2000 then 'In Progress'

when ae.AppEnforcementState = 2001 then 'Waiting for Content'

when ae.AppEnforcementState = 2002 then 'Installing'

when ae.AppEnforcementState = 2003 then 'Restart to Continue'

when ae.AppEnforcementState = 2004 then 'Waiting for maintenance window'

when ae.AppEnforcementState = 2005 then 'Waiting for schedule'

when ae.AppEnforcementState = 2006 then 'Downloading dependent content'

when ae.AppEnforcementState = 2007 then 'Installing dependent content'

when ae.AppEnforcementState = 2008 then 'Restart to complete'

when ae.AppEnforcementState = 2009 then 'Content downloaded'

when ae.AppEnforcementState = 2010 then 'Waiting for update'

when ae.AppEnforcementState = 2011 then 'Waiting for user session reconnect'

when ae.AppEnforcementState = 2012 then 'Waiting for user logoff'

when ae.AppEnforcementState = 2013 then 'Waiting for user logon'

when ae.AppEnforcementState = 2014 then 'Waiting to install'

when ae.AppEnforcementState = 2015 then 'Waiting retry'

when ae.AppEnforcementState = 2016 then 'Waiting for presentation mode'

when ae.AppEnforcementState = 2017 then 'Waiting for Orchestration'


when ae.AppEnforcementState = 2018 then 'Waiting for network'

when ae.AppEnforcementState = 2019 then 'Pending App-V Virtual Environment'

when ae.AppEnforcementState = 2020 then 'Updating App-V Virtual Environment'

when ae.AppEnforcementState = 3000 then 'Requirements not met'

when ae.AppEnforcementState = 3001 then 'Host platform not applicable'

when ae.AppEnforcementState = 4000 then 'Unknown'

when ae.AppEnforcementState = 5000 then 'Deployment failed'

when ae.AppEnforcementState = 5001 then 'Evaluation failed'

when ae.AppEnforcementState = 5002 then 'Deployment failed'

when ae.AppEnforcementState = 5003 then 'Failed to locate content'

when ae.AppEnforcementState = 5004 then 'Dependency installation failed'

when ae.AppEnforcementState = 5005 then 'Failed to download dependent content'

when ae.AppEnforcementState = 5006 then 'Conflicts with another application deployment'

when ae.AppEnforcementState = 5007 then 'Waiting retry'

when ae.AppEnforcementState = 5008 then 'Failed to uninstall superseded deployment type'

when ae.AppEnforcementState = 5009 then 'Failed to download superseded deployment type'

when ae.AppEnforcementState = 5010 then 'Failed to updating App-V Virtual Environment'

else 'No Status'

End as 'State Message',

vrs.Operating_System_Name_and0,vrs.AD_Site_Name0,

ae.LastModificationTime

--ae.ComplianceState

from v_R_System Vrs

join vAppDTDeploymentResultsPerClient ae on ae.ResourceID=Vrs.ResourceID

join v_ApplicationAssignment aa on ae.AssignmentID = aa.AssignmentID

where aa.AssignmentID = '16778174' order by [State Message] desc

Application List Based On Collection ID:-


select sys.Netbios_Name0, arp.DisplayName0, arp.Version0, arp.Publisher0, arp.InstallDate0 from
v_R_System sys left join v_Add_Remove_Programs arp on sys.ResourceID = arp.ResourceID left join
v_FullCollectionMembership C on sys.ResourceID = c.ResourceID where c.CollectionID like 'CHZ002BA'

ARP report:-
Select
distinct
v_R_System.Name0,
v_R_System.Resource_Domain_OR_Workgr0,
v_Add_Remove_Programs.DisplayName0,
v_Add_Remove_Programs.Version0,
v_Add_Remove_Programs.ProdID0,
v_R_System.Operating_System_Name_and0
--v_Add_Remove_Programs.InstallDate0
 
from v_R_System
 
join v_Add_Remove_Programs on
v_R_System.ResourceID = v_Add_Remove_Programs.ResourceID
 
where
v_R_System.Client0=0
 and
v_Add_Remove_Programs.DisplayName0 like '%1E Client%'
 
order by v_R_System.Resource_Domain_OR_Workgr0

ARP:-

select distinct
b.Name0,Operating_System_Name_and0,a.DisplayName0,Version0,Last_Logon_Timestamp0,vru.User_
Principal_Name0 as "Email",vru.User_Name0

from v_Add_Remove_Programs a

join v_R_System b on a.ResourceID=b.ResourceID

join v_R_User vru on b.User_Name0=vru.User_Name0

where a.DisplayName0 like '%Adobe%'

order by DisplayName0
Configuration baseline:-

select distinct VRS.Netbios_Name0, CI.ComplianceStateName from v_R_System VRS

right join v_FullCollectionMembership_Valid FM on VRS.ResourceID=FM.ResourceID

right join fn_ListCI_ComplianceState(1033) CI on VRS.ResourceID=CI.ResourceID

where CI.CI_ID='16844707'

and FM.CollectionID='CHZ00369'

Driver installed:-

DECLARE @collectionID char(8)

set @collectionID = 'SMS00001'

SELECT

v_FullCollectionMembership.Name,

v_GS_PNP_DEVICE_DRIVER.Name0,

v_GS_PNP_DEVICE_DRIVER.PNPDeviceID0

FROM

v_FullCollectionMembership

INNER JOIN

v_GS_PNP_DEVICE_DRIVER

ON

v_FullCollectionMembership.ResourceID = v_GS_PNP_DEVICE_DRIVER.ResourceID

WHERE

(v_FullCollectionMembership.CollectionID = CHZ0017D)

Extensive Inventory:-

select distinct Netbios_Name0 as "Machine name",vrs.User_Name0 as "User ID",vru.Full_User_Name0


as "User Full Name",

AD_Site_Name0 as "AD Site",


case

when vrs.Active0 = 1 then 'YES'

when vrs.Active0 = 0 then 'NO'

else 'NO STATUS'

end AS "Machine Active",

case

when vrs.Client0 = 1 then 'YES'

when vrs.Client0 = 0 then 'NO'

else 'NO STATUS'

end AS "Client Active", Client_Version0 as "Client Version",vrs.Full_Domain_Name0 as "Domain


Name",

vru.User_Principal_Name0 as "Email",Last_Logon_Timestamp0 as "Last Login Time",os.Caption0 as


"Operating System",

os.Version0 as "OS Version",os.CSDVersion0 as "OS Service Pack",vcs.Manufacturer0 as


"Manufacture", vcs.Model0 as "HW Model",

vgp.Name0 as "Processor", vip.IPAddress0 as "IP Address", vip.MACAddress0 as "MAC Address",


RAM.Capacity0/1024 as "RAM Gb",

vcs.SystemType0 as "Machine Type", vld.Size0/1024 as "HD Size GB", vld.FreeSpace0/1024 as "HD


Free GB",

vad.AgentTime as "Last Heartbeat", vws.LastHWScan as "Last HW Scan",vcs.UserName0 as "Last


Logged User"

from dbo.v_R_System vrs

join v_R_User vru on vrs.User_Name0=vru.User_Name0

join V_GS_operating_system os on vrs.ResourceID=os.ResourceID

join v_GS_COMPUTER_SYSTEM vcs on vrs.ResourceID=vcs.ResourceID

join v_GS_PROCESSOR vgp on vrs.ResourceID=vgp.ResourceID

join v_GS_NETWORK_ADAPTER_CONFIGUR vip on vrs.ResourceID=vip.ResourceID and vip.IPAddress0 is


not null

join v_GS_PHYSICAL_MEMORY ram on vrs.ResourceID=ram.ResourceID


join v_GS_LOGICAL_DISK vld on vrs.ResourceID=vld.ResourceID and vld.Size0 is not null

join v_AgentDiscoveries vad on vrs.ResourceID=vad.ResourceID and vad.AgentName = 'Heartbeat


Discovery'

join v_GS_WORKSTATION_STATUS vws on vrs.ResourceID=vws.ResourceID

order by vrs.Netbios_Name0

File location:-

select

v_GS_SYSTEM.Name0,

v_GS_SoftwareFile.FileName,

v_GS_SoftwareFile.FileVersion,

v_GS_SoftwareFile.FilePath,

v_GS_SoftwareFile.FileModifiedDate

from v_GS_SoftwareFile inner join v_GS_SYSTEM

on v_GS_SoftwareFile.ResourceID = v_GS_SYSTEM.ResourceID

where FileName like '%torrent.exe'

Hardware Inventory:-

SELECT TOP 100 PERCENT dbo.v_R_System.Name0 AS [Computer Name], dbo.v_R_System.Client0 AS


[SMS Client],

CASE dbo.v_GS_SYSTEM_ENCLOSURE.ChassisTypes0 WHEN '1' THEN 'VIRTUAL' WHEN '2'


THEN 'DESKTOP' WHEN '3' THEN 'DESKTOP' WHEN '4' THEN

'DESKTOP' WHEN '5' THEN 'DESKTOP' WHEN '6' THEN 'DESKTOP' WHEN '7' THEN 'DESKTOP'
WHEN '8' THEN 'LAPTOP' WHEN '9' THEN 'LAPTOP' WHEN

'10' THEN 'LAPTOP' WHEN '12' THEN 'DOCKING STATION' WHEN '14' THEN 'LAPTOP' WHEN
'15' THEN 'DESKTOP' WHEN '17' THEN 'SERVER' WHEN

'18' THEN 'SERVER' WHEN '19' THEN 'SERVER' WHEN '20' THEN 'SERVER' WHEN '21' THEN
'DOCKING STATION' WHEN '23' THEN 'SERVER' WHEN

'24' THEN 'DESKTOP' WHEN '65' THEN 'LAPTOP' ELSE


isnull(dbo.v_GS_SYSTEM_ENCLOSURE.ChassisTypes0, '') END AS [Asset Type],

dbo.v_R_System.AD_Site_Name0 AS [AD Site], dbo.v_R_System.User_Name0 AS [Last


Recorded User], dbo.v_R_System.User_Domain0, dbo.v_R_System.Full_Domain_Name0,
dbo.v_R_System.Creation_Date0 AS [SMS Creation Date], tblHB.LastHeartbeat AS [Last SMS
HeartBeat],

dbo.v_GS_WORKSTATION_STATUS.LastHWScan AS [Last HW Inventory],


dbo.v_GS_LastSoftwareScan.LastScanDate AS [Last SW Inventory],

dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0 AS [Last Bootup Time],


dbo.v_GS_COMPUTER_SYSTEM.Manufacturer0 AS Manufacturer,

dbo.v_GS_COMPUTER_SYSTEM.Model0 AS Model,
dbo.v_GS_SYSTEM_ENCLOSURE.SerialNumber0 AS Serial,

dbo.v_GS_OPERATING_SYSTEM.Caption0 AS [Operating System],


dbo.v_GS_OPERATING_SYSTEM.CSDVersion0 AS [Service Pack],

v_GS_DISK_1.Size0 / 1024 AS [Primary HDD Size (GB)],


dbo.v_GS_X86_PC_MEMORY.TotalPhysicalMemory0 / 1024 AS [Installed RAM (MB)],

v_GS_PROCESSOR_1.Name0

FROM (SELECT ResourceId, MAX(AgentTime) AS LastHeartbeat

FROM dbo.v_AgentDiscoveries

WHERE (AgentName = 'Heartbeat Discovery')

GROUP BY ResourceId) AS tblHB RIGHT OUTER JOIN

dbo.v_R_System LEFT OUTER JOIN

dbo.v_GS_PROCESSOR AS v_GS_PROCESSOR_1 INNER JOIN

(SELECT ResourceID, MIN(DeviceID0) AS DeviceID0

FROM dbo.v_GS_PROCESSOR

GROUP BY ResourceID) AS tblCPU ON v_GS_PROCESSOR_1.ResourceID =


tblCPU.ResourceID AND

v_GS_PROCESSOR_1.DeviceID0 = tblCPU.DeviceID0 ON dbo.v_R_System.ResourceID =


tblCPU.ResourceID LEFT OUTER JOIN

dbo.v_GS_X86_PC_MEMORY ON dbo.v_R_System.ResourceID =
dbo.v_GS_X86_PC_MEMORY.ResourceID LEFT OUTER JOIN

(SELECT ResourceID, MIN(DeviceID0) AS DeviceID0

FROM dbo.v_GS_DISK

GROUP BY ResourceID) AS tblDISK INNER JOIN

dbo.v_GS_DISK AS v_GS_DISK_1 ON tblDISK.ResourceID = v_GS_DISK_1.ResourceID AND


tblDISK.DeviceID0 = v_GS_DISK_1.DeviceID0 ON
dbo.v_R_System.ResourceID = tblDISK.ResourceID LEFT OUTER JOIN

dbo.v_GS_SYSTEM_ENCLOSURE ON dbo.v_R_System.ResourceID =
dbo.v_GS_SYSTEM_ENCLOSURE.ResourceID LEFT OUTER JOIN

dbo.v_GS_LastSoftwareScan ON dbo.v_R_System.ResourceID =
dbo.v_GS_LastSoftwareScan.ResourceID LEFT OUTER JOIN

dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID =
dbo.v_GS_OPERATING_SYSTEM.ResourceID LEFT OUTER JOIN

dbo.v_GS_COMPUTER_SYSTEM ON dbo.v_R_System.ResourceID =
dbo.v_GS_COMPUTER_SYSTEM.ResourceID LEFT OUTER JOIN

dbo.v_GS_WORKSTATION_STATUS ON dbo.v_R_System.ResourceID =
dbo.v_GS_WORKSTATION_STATUS.ResourceID ON

tblHB.ResourceId = dbo.v_R_System.ResourceID

ORDER BY [Computer Name]

LifeCycle:-

SELECT ALL

Category

, GroupName

, InstallCount

, MainstreamSupportEndDateAsDate AS MainstreamSupportEndDate

, ExtendedSupportEndDateAsDate AS ExtendedSupportEndDate

, CASE WHEN COALESCE(ExtendedSupportEndDateAsDate, MainstreamSupportEndDateAsDate)


<= getdate()

THEN 0

ELSE

DATEDIFF(DAY, getdate(), COALESCE(ExtendedSupportEndDateAsDate,


MainstreamSupportEndDateAsDate))

END AS DaysOfSupportRemaining

, COALESCE(MoreInformationLink, 'https://support.microsoft.com/en-us/lifecycle/search?
alpha='+GroupName) AS MoreInformationLink

FROM v_LifecycleDetectedGroups
ORDER BY COALESCE(ExtendedSupportEndDateAsDate, MainstreamSupportEndDateAsDate)

Logical Disk Space wrt Drive:-

SELECT

SYS.Name,

LDISK.DeviceID0,

LDISK.VolumeName0,

LDISK.FreeSpace0/1024 as [Free space (GB)],

LDISK.Size0/1024 as [Total space (GB)]

FROM v_FullCollectionMembership SYS

JOIN v_GS_LOGICAL_DISK LDISK on SYS.ResourceID = LDISK.ResourceID

JOIN v_R_System RSYS ON SYS.ResourceID = RSYS.ResourceID

WHERE

LDISK.DeviceID0 = 'C:'

AND LDISK.DriveType0 = 3

AND LDISK.Size0 > 0

AND SYS.CollectionID = 'CHZ00019'

ORDER BY SYS.Name, LDISK.DeviceID0

Monthly Compliance:-

select

vrs.Name0,

vrs.AD_Site_Name0,

vrs.User_Name0,

uss.LastScanTime,

uss.LastErrorCode,

uss.lastscanpackagelocation,

a.AssignmentName as DeploymentName,
sn.StateName as LastEnforcementState,

case when osd.Caption00 like '%Windows 10 Pro%' then 'Windows 10 Pro '

when osd.Caption00 like '%Windows 10 Enterprise 2016 LTSB%' then 'Windows 10 Enterprise LTSB '

when osd.Caption00 like '%Windows 10 Ent%' then 'Windows 10 Enterprise '

when osd.Caption00 like '%Windows 10 ???%' then 'Windows 10 Enterprise '

else 'Windows 10 Pro '

End as 'Caption',

case when osd.version00 = '10.0.14393' then '1607'

when osd.version00 = '10.0.17134' then '1803'

when osd.version00 = '10.0.16299' then '1709'

when osd.version00 = '10.0.18362' then '1903'

when osd.version00 = '10.0.17763' then '1809'

when osd.version00 = '10.0.15063' then '1703'

when osd.version00 = '10.0.18363' then '1909'

when osd.version00 = '10.0.10240' then '1507 (RTM)'

when osd.version00 = '10.0.19041' then '2004'

when osd.version00 = '10.0.19042' then '20H2'

else 'Unknown'

End as 'Windows 10 Version'

from v_CIAssignment a

left join v_AssignmentState_Combined assc on a.AssignmentID=assc.AssignmentID

left join v_StateNames sn on assc.StateType = sn.TopicType and sn.StateID=isnull(assc.StateID,0)

left join v_R_System vrs on vrs.ResourceID=assc.ResourceID

left join v_UpdateScanStatus uss ON uss.ResourceID = assc.ResourceID

left join Operating_System_DATA osd ON uss.ResourceID = osd.MachineID

where

a.AssignmentName like '%Windows 10 Monthly Updates PRD 1%' OR

a.AssignmentName like '%Windows 10 Monthly Updates PRD 2%' OR

a.AssignmentName like '%Windows 10 Monthly Updates PRD 3%'


Office Addin:-

Select

distinct

v_R_System.Name0,

Office_Addin_DATA.Architecture00,

Office_Addin_DATA.officeapp00,

Office_Addin_DATA.friendlyname00,

Office_Addin_DATA.companyname00,

Office_Addin_DATA.ProductVersion00

from v_R_System

join Office_Addin_DATA on

v_R_System.ResourceID = OFFICE_ADDIN_DATA.MachineID

Office Architecture:-

select v_R_System.Name0,

v_R_System.Netbios_Name0,

v_r_system.AD_Site_Name0,

v_r_system.Operating_System_Name_and0,

v_GS_OFFICE_PRODUCTINFO.Architecture0,

v_GS_OFFICE_PRODUCTINFO.ProductName0,

v_GS_OFFICE_PRODUCTINFO.ProductVersion0,

v_GS_OFFICE_PRODUCTINFO.Channel0

from v_GS_OFFICE_PRODUCTINFO

join

v_R_System on v_GS_OFFICE_PRODUCTINFO.ResourceID=v_R_System.ResourceID

where
v_GS_OFFICE_PRODUCTINFO.ProductName0 like '%office 365 pro%' or

v_GS_OFFICE_PRODUCTINFO.ProductName0 like '%Microsoft % Standard%' or

v_GS_OFFICE_PRODUCTINFO.ProductName0 like '%oMicrosoft % Professional%' or

v_GS_OFFICE_PRODUCTINFO.ProductName0 like '%Microsoft % Enterprise %'

Office Inventory:-

Select

distinct

v_R_System.Name0,

v_Add_Remove_Programs.DisplayName0,

v_Add_Remove_Programs.Version0

--v_Add_Remove_Programs.ProdID0

from v_R_System

join v_Add_Remove_Programs on

v_R_System.ResourceID = v_Add_Remove_Programs.ResourceID

where

v_Add_Remove_Programs.DisplayName0 like '%Microsoft Office Standard%' or

v_Add_Remove_Programs.DisplayName0 like '%Microsoft Office Professional%' or

v_Add_Remove_Programs.DisplayName0 like '%Microsoft Office Enterprise%' or

v_Add_Remove_Programs.DisplayName0 like '%Microsoft Office 365%' or

v_Add_Remove_Programs.DisplayName0 like '%Microsoft 365 apps%'

order by 1
OS Details:-

SELECT DISTINCT

dbo.v_R_System.Netbios_Name0 as [Machine Name],dbo.v_R_System.User_Name0 as [User


Name],dbo.v_R_System.AD_Site_Name0 as [AD Site],

dbo.v_R_System.User_Domain0 as [Domain]

, dbo.v_GS_OPERATING_SYSTEM.Caption0 as [OS Name],

dbo.v_GS_OPERATING_SYSTEM.CSDVersion0 as [SP Name],

dbo.v_R_System.Operating_System_Name_and0 as [OS NT Version],

dbo.v_GS_OPERATING_SYSTEM.BuildNumber0 as [Build Number],

dbo.v_GS_OPERATING_SYSTEM.OSLanguage0 as [OS Language]

FROM dbo.v_R_System INNER JOIN

dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID =
dbo.v_GS_OPERATING_SYSTEM.ResourceID

Package Deployment:-

select v_R_System.Name0, v_R_System.User_Name0,v_AdvertisementInfo.AdvertisementName,

v_AdvertisementInfo.AdvertisementID,v_ClientAdvertisementStatus.LastStatusMessageIDName,

v_ClientAdvertisementStatus.LastStateName

from v_R_System

join v_ClientAdvertisementStatus on v_R_System.ResourceID=v_ClientAdvertisementStatus.ResourceID

join v_AdvertisementInfo on
v_ClientAdvertisementStatus.AdvertisementID=v_AdvertisementInfo.AdvertisementID

where v_ClientAdvertisementStatus.AdvertisementID='CHZ20139'
Patch status:-

select

vrs.Name0,

vrs.AD_Site_Name0,

vrs.User_Name0,

a.AssignmentName as DeploymentName,

sn.StateName as LastEnforcementState,

case when osd.Caption00 like '%Windows 10 Pro%' then 'Windows 10 Pro '

when osd.Caption00 like '%Windows 10 Enterprise 2016 LTSB%' then 'Windows 10 Enterprise LTSB '

when osd.Caption00 like '%Windows 10 Ent%' then 'Windows 10 Enterprise '

when osd.Caption00 like '%Windows 10 ???%' then 'Windows 10 Enterprise '

else 'Windows 10 Pro '

End as 'Caption',

case

when osd.version00 = '10.0.10240' then '1507 (RTM)'

when osd.version00 = '10.0.10586' then '1511'

when osd.version00 = '10.0.14393' then '1607'

when osd.version00 = '10.0.15063' then '1703'

when osd.version00 = '10.0.16299' then '1709'

when osd.version00 = '10.0.17134' then '1803'

when osd.version00 = '10.0.17763' then '1809'

when osd.version00 = '10.0.18362' then '1903'

when osd.version00 = '10.0.18363' then '1909'

when osd.version00 = '10.0.19041' then '2004'

when osd.version00 = '10.0.19042' then '20H2'

else 'Unknown'

End as 'Windows 10 Version'

from v_CIAssignment a

left join v_AssignmentState_Combined assc on a.AssignmentID=assc.AssignmentID


left join v_StateNames sn on assc.StateType = sn.TopicType and sn.StateID=isnull(assc.StateID,0)

left join v_R_System vrs on vrs.ResourceID=assc.ResourceID

left join v_UpdateScanStatus uss ON uss.ResourceID = assc.ResourceID

left join Operating_System_DATA osd ON uss.ResourceID = osd.MachineID

where a.AssignmentName = 'Windows 10 Feature Update 1909 to 20H2_TST'

Regular reports needed – WIN10:-

select

v_R_System.Netbios_Name0 as [Device Name],

v_R_System.User_Name0 as [User ID],

--v_R_User.User_Name0 as [User ID],

v_R_System.Last_Logon_Timestamp0 as [Last Logon Time],

v_R_System.Creation_Date0 as [Creation Date],

v_GS_COMPUTER_SYSTEM.Manufacturer0 as [Manufacturer],

v_GS_COMPUTER_SYSTEM.Model0 as [Model],

v_GS_SYSTEM_ENCLOSURE.SerialNumber0 as [Serial Number],

v_GS_PC_BIOS.SMBIOSBIOSVersion0 as [BIOS Version],

v_GS_OPERATING_SYSTEM.Caption0 as [OS Name],

v_GS_OPERATING_SYSTEM.BuildNumber0 as [OS Build Number],

case

when v_GS_OPERATING_SYSTEM.BuildNumber0=10240 then '1507'

when v_GS_OPERATING_SYSTEM.BuildNumber0=10586 then '1511'

when v_GS_OPERATING_SYSTEM.BuildNumber0=14393 then '1607'

when v_GS_OPERATING_SYSTEM.BuildNumber0=15063 then '1703'

when v_GS_OPERATING_SYSTEM.BuildNumber0=16299 then '1709'

when v_GS_OPERATING_SYSTEM.BuildNumber0=17134 then '1803'

when v_GS_OPERATING_SYSTEM.BuildNumber0=17763 then '1809'

when v_GS_OPERATING_SYSTEM.BuildNumber0=18362 then '1903'

when v_GS_OPERATING_SYSTEM.BuildNumber0=18363 then '1909'


when v_GS_OPERATING_SYSTEM.BuildNumber0=19041 then '2004'

when v_GS_OPERATING_SYSTEM.BuildNumber0=19042 then '20H2'

else 'Null'

end as "OS Version",

v_GS_OPERATING_SYSTEM.LastBootUpTime0 as [Last Bootup Time],

case

when v_CH_ClientSummary.ClientActiveStatus=1 then 'Active'

when v_CH_ClientSummary.ClientActiveStatus=0 then 'Inactive'

else 'Null'

end as "Client Activity",

v_CH_ClientSummary.LastPolicyRequest

from v_R_System

join v_GS_COMPUTER_SYSTEM on v_R_System.ResourceID=v_GS_COMPUTER_SYSTEM.ResourceID

join v_GS_SYSTEM_ENCLOSURE on v_R_System.ResourceID=v_GS_SYSTEM_ENCLOSURE.ResourceID

join v_GS_OPERATING_SYSTEM on v_R_System.ResourceID=v_GS_OPERATING_SYSTEM.ResourceID

join v_CH_ClientSummary on v_R_System.ResourceID=v_CH_ClientSummary.ResourceID

join v_GS_PC_BIOS on v_R_System.ResourceID=v_GS_PC_BIOS.ResourceID

--join v_R_User on v_R_System.User_Name0=v_R_User.User_Name0

where

v_GS_OPERATING_SYSTEM.Caption0 like '%windows 10%'

order by 1

SLIM ARP 32 & 64 Bit:-

SELECT DISTINCT

Replace(Computer_System_DATA."Name00",char(44), char(32)) as PCName,

LTrim(Left(Replace(Replace(isnull(v_GS_ADD_REMOVE_PROGRAMS."Publisher0",''),CHAR(34),''),CHAR(4
4),CHAR(32)),100)) as Publisher,

LTrim(Left(Replace(Replace(isnull(v_GS_ADD_REMOVE_PROGRAMS."DisplayName0",''),CHAR(34),''),CH
AR(44),CHAR(32)),250)) as Displayname,
LTrim(Left(Replace(Replace(isnull(v_GS_ADD_REMOVE_PROGRAMS."Version0",''),CHAR(34),''),CHAR(44)
,CHAR(32)),100)) as Version,

v_GS_Workstation_Status."LastHWScan" as LastScanDate,

Replace(v_GS_PC_BIOS."SerialNumber0", char(44),char(32)) as SerialNumber

FROM

{ oj (("v_GS_ADD_REMOVE_PROGRAMS" v_GS_ADD_REMOVE_PROGRAMS

INNER JOIN "Computer_System_DATA" Computer_System_DATA ON

v_GS_ADD_REMOVE_PROGRAMS."ResourceID" = Computer_System_DATA."MachineID")

INNER JOIN "v_GS_PC_BIOS" v_GS_PC_BIOS ON

Computer_System_DATA."MachineID" = v_GS_PC_BIOS."ResourceID")

INNER JOIN "v_GS_Workstation_Status" v_GS_Workstation_Status ON

Computer_System_DATA."MachineID" = v_GS_Workstation_Status."ResourceID"

INNER JOIN "v_R_System" v_R_System ON

Computer_System_DATA. "MachineID" = v_R_System."ResourceID"}

WHERE

displayname0 NOT LIKE 'Windows XP Service Pack 2'AND

displayname0 NOT LIKE 'Windows Rights Management client'AND

displayname0 NOT LIKE 'WebFldrs XP'AND

displayname0 NOT LIKE 'Rights Management Add-on for Internet Explorer'AND

displayname0 NOT LIKE 'Windows XP Hotfix%'AND

displayname0 NOT LIKE 'Windows Installer%'AND

displayname0 NOT LIKE 'Windows Genuine Advantage Notifications%'AND

displayname0 NOT LIKE 'Update for Windows XP%'AND

displayname0 NOT LIKE 'Security Update for Windows%'AND

displayname0 NOT LIKE 'Microsoft .NET Framework%'AND

displayname0 NOT LIKE 'Hotfix for Windows%'AND

displayname0 NOT LIKE '%(KB%' AND


displayname0 NOT LIKE '%- KB%' AND

displayname0 NOT LIKE '%Service Pack 1 (SP1)' AND

displayname0 NOT LIKE '%Service Pack 2 (SP2)' AND

displayname0 NOT LIKE 'Aggiornamento rapido%' AND

displayname0 NOT LIKE 'Fichiers de prise%' AND

displayname0 NOT LIKE 'Fichiers support d%instal%' AND

displayname0 NOT LIKE 'File di supporto%' AND

displayname0 NOT LIKE 'Hjälpfiler för%' AND

displayname0 NOT LIKE 'Hotfix voor%' AND

displayname0 NOT LIKE 'Unterstützungsdateien%' AND

displayname0 NOT LIKE 'Updatepakket 1 voor%' AND

displayname0 NOT LIKE 'Updaterollup 1 für%' AND

displayname0 NOT LIKE '%Weitere Informationen%' AND

displayname0 NOT LIKE '%Windows XP Service%' AND

displayname0 NOT LIKE '%XP-Hotfix%' AND

displayname0 NOT LIKE '%2000-Hotfix%'

UNION

SELECT DISTINCT

Replace(Computer_System_DATA."Name00",char(44), char(32)) as PCName,

LTrim(Left(Replace(Replace(isnull(v_GS_ADD_REMOVE_PROGRAMS_64."Publisher0",''),CHAR(34),''),CH
AR(44),CHAR(32)),100)) as Publisher,

LTrim(Left(Replace(Replace(isnull(v_GS_ADD_REMOVE_PROGRAMS_64."DisplayName0",''),CHAR(34),''),
CHAR(44),CHAR(32)),250)) as Displayname,

LTrim(Left(Replace(Replace(isnull(v_GS_ADD_REMOVE_PROGRAMS_64."Version0",''),CHAR(34),''),CHAR
(44),CHAR(32)),100)) as Version,

v_GS_Workstation_Status."LastHWScan" as LastScanDate,

Replace(v_GS_PC_BIOS."SerialNumber0", char(44),char(32)) as SerialNumber

FROM
{ oj (("v_GS_ADD_REMOVE_PROGRAMS_64" v_GS_ADD_REMOVE_PROGRAMS_64

INNER JOIN "Computer_System_DATA" Computer_System_DATA ON

v_GS_ADD_REMOVE_PROGRAMS_64."ResourceID" = Computer_System_DATA."MachineID")

INNER JOIN "v_GS_PC_BIOS" v_GS_PC_BIOS ON

Computer_System_DATA."MachineID" = v_GS_PC_BIOS."ResourceID")

INNER JOIN "v_GS_Workstation_Status" v_GS_Workstation_Status ON

Computer_System_DATA."MachineID" = v_GS_Workstation_Status."ResourceID"}

INNER JOIN "v_R_System" v_R_System ON

Computer_System_DATA. "MachineID" = v_R_System."ResourceID"

WHERE

displayname0 NOT LIKE 'Windows XP Service Pack 2'AND

displayname0 NOT LIKE 'Windows Rights Management client'AND

displayname0 NOT LIKE 'WebFldrs XP'AND

displayname0 NOT LIKE 'Rights Management Add-on for Internet Explorer'AND

displayname0 NOT LIKE 'Windows XP Hotfix%'AND

displayname0 NOT LIKE 'Windows Installer%'AND

displayname0 NOT LIKE 'Windows Genuine Advantage Notifications%'AND

displayname0 NOT LIKE 'Update for Windows XP%'AND

displayname0 NOT LIKE 'Security Update for Windows%'AND

displayname0 NOT LIKE 'Microsoft .NET Framework%'AND

displayname0 NOT LIKE 'Hotfix for Windows%'AND

displayname0 NOT LIKE '%(KB%' AND

displayname0 NOT LIKE '%- KB%' AND

displayname0 NOT LIKE '%Service Pack 1 (SP1)' AND

displayname0 NOT LIKE '%Service Pack 2 (SP2)' AND

displayname0 NOT LIKE 'Aggiornamento rapido%' AND

displayname0 NOT LIKE 'Fichiers de prise%' AND

displayname0 NOT LIKE 'Fichiers support d%instal%' AND


displayname0 NOT LIKE 'File di supporto%' AND

displayname0 NOT LIKE 'Hjälpfiler för%' AND

displayname0 NOT LIKE 'Hotfix voor%' AND

displayname0 NOT LIKE 'Unterstützungsdateien%' AND

displayname0 NOT LIKE 'Updatepakket 1 voor%' AND

displayname0 NOT LIKE 'Updaterollup 1 für%' AND

displayname0 NOT LIKE '%Weitere Informationen%' AND

displayname0 NOT LIKE '%Windows XP Service%' AND

displayname0 NOT LIKE '%XP-Hotfix%' AND

displayname0 NOT LIKE '%2000-Hotfix%'

SLIM OS Details:-

SELECT DISTINCT

Replace(Computer_System_DATA."Name00",char(44), char(32)) as PCName,

LTrim(Left(Replace(Replace(isnull(v_GS_OPERATING_SYSTEM."Manufacturer0",''),CHAR(34),''),CHAR(44)
,CHAR(32)),100)) as Publisher,

LTrim(Left(Replace(Replace(isnull(v_GS_OPERATING_SYSTEM."Caption0",''),CHAR(34),''),CHAR(44),CHAR
(32)),250)) as Displayname,

LTrim(Left(Replace(Replace(isnull(v_GS_OPERATING_SYSTEM."Version0",''),CHAR(34),''),CHAR(44),CHAR
(32)),100)) as Version,

v_GS_Workstation_Status."LastHWScan" as LastScanDate,

Replace(v_GS_PC_BIOS."SerialNumber0", char(44),char(32)) as SerialNumber

FROM

{ oj (("v_GS_OPERATING_SYSTEM" v_GS_OPERATING_SYSTEM

INNER JOIN "Computer_System_DATA" Computer_System_DATA ON

v_GS_OPERATING_SYSTEM."ResourceID" = Computer_System_DATA."MachineID")

INNER JOIN "v_GS_PC_BIOS" v_GS_PC_BIOS ON

Computer_System_DATA."MachineID" = v_GS_PC_BIOS."ResourceID")
INNER JOIN "v_GS_Workstation_Status" v_GS_Workstation_Status ON

Computer_System_DATA."MachineID" = v_GS_Workstation_Status."ResourceID"

INNER JOIN "v_R_System" v_R_System ON

Computer_System_DATA. "MachineID" = v_R_System."ResourceID"}

Specific KB status:-

Select

a.name0 [Machine Name],

c.BulletinID,

c.Title,

--d.CategoryInstanceName [UpdatesClassification],

--CASE((c.Severity))

--When 2 Then 'Low'

--When 6 Then 'Moderate'

--When 8 Then 'Important'

--When 10 Then 'Critical'

--Else 'NA' End as 'Severity',

CASE((b.Status))

When 3 Then 'Installed'

When 2 Then 'Required'

When 0 Then 'Unknown'

Else 'Not Required' End as 'Status'

from v_R_System a join

v_Update_ComplianceStatusReported b on a.ResourceID=b.ResourceID join

v_UpdateInfo c on b.CI_ID=c.CI_ID join

v_CICategoryInfo_All d on d.CI_ID=c.CI_ID

where

--c.Title = '--'

c.ArticleID = '5004948'

You might also like