Queries
Queries
Queries
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,
wks.LastHWScan,
from v_CIAssignment a
order by 11 desc
Last Patch Details:
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
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
aa.CollectionID,v_ContentInfo.ContentSource
FROM dbo.fn_ListDeploymentTypeCIs(1033) AS dt
case
FROM dbo.fn_ListDeploymentTypeCIs(1033) AS dt
inner join dbo.fn_ListLatestApplicationCIs(1033) AS app ON dt.AppModelName = app.ModelName
select distinct
vrs.user_name0,fn.machinename,fn.applicationname,fn.deploymenttypename,fn.Enforcementtime,erro
rcode,
end as 'Laststatusmessage'
select
aa.CollectionName,
aa.ApplicationName,
Vrs.Name0,
vrs.Operating_System_Name_and0,vrs.AD_Site_Name0,
ae.LastModificationTime
--ae.ComplianceState
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
order by DisplayName0
Configuration baseline:-
where CI.CI_ID='16844707'
and FM.CollectionID='CHZ00369'
Driver installed:-
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:-
case
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
on v_GS_SoftwareFile.ResourceID = v_GS_SYSTEM.ResourceID
Hardware Inventory:-
'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
dbo.v_GS_COMPUTER_SYSTEM.Model0 AS Model,
dbo.v_GS_SYSTEM_ENCLOSURE.SerialNumber0 AS Serial,
v_GS_PROCESSOR_1.Name0
FROM dbo.v_AgentDiscoveries
FROM dbo.v_GS_PROCESSOR
dbo.v_GS_X86_PC_MEMORY ON dbo.v_R_System.ResourceID =
dbo.v_GS_X86_PC_MEMORY.ResourceID LEFT OUTER JOIN
FROM dbo.v_GS_DISK
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
LifeCycle:-
SELECT ALL
Category
, GroupName
, InstallCount
, MainstreamSupportEndDateAsDate AS MainstreamSupportEndDate
, ExtendedSupportEndDateAsDate AS ExtendedSupportEndDate
THEN 0
ELSE
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)
SELECT
SYS.Name,
LDISK.DeviceID0,
LDISK.VolumeName0,
WHERE
LDISK.DeviceID0 = 'C:'
AND LDISK.DriveType0 = 3
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 '
End as 'Caption',
else 'Unknown'
from v_CIAssignment a
where
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
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
order by 1
OS Details:-
SELECT DISTINCT
dbo.v_R_System.User_Domain0 as [Domain]
dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID =
dbo.v_GS_OPERATING_SYSTEM.ResourceID
Package Deployment:-
v_AdvertisementInfo.AdvertisementID,v_ClientAdvertisementStatus.LastStatusMessageIDName,
v_ClientAdvertisementStatus.LastStateName
from v_R_System
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 '
End as 'Caption',
case
else 'Unknown'
from v_CIAssignment a
select
v_GS_COMPUTER_SYSTEM.Manufacturer0 as [Manufacturer],
v_GS_COMPUTER_SYSTEM.Model0 as [Model],
case
else 'Null'
case
else 'Null'
v_CH_ClientSummary.LastPolicyRequest
from v_R_System
where
order by 1
SELECT DISTINCT
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,
FROM
{ oj (("v_GS_ADD_REMOVE_PROGRAMS" v_GS_ADD_REMOVE_PROGRAMS
v_GS_ADD_REMOVE_PROGRAMS."ResourceID" = Computer_System_DATA."MachineID")
Computer_System_DATA."MachineID" = v_GS_PC_BIOS."ResourceID")
Computer_System_DATA."MachineID" = v_GS_Workstation_Status."ResourceID"
WHERE
UNION
SELECT DISTINCT
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,
FROM
{ oj (("v_GS_ADD_REMOVE_PROGRAMS_64" v_GS_ADD_REMOVE_PROGRAMS_64
v_GS_ADD_REMOVE_PROGRAMS_64."ResourceID" = Computer_System_DATA."MachineID")
Computer_System_DATA."MachineID" = v_GS_PC_BIOS."ResourceID")
Computer_System_DATA."MachineID" = v_GS_Workstation_Status."ResourceID"}
WHERE
SLIM OS Details:-
SELECT DISTINCT
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,
FROM
{ oj (("v_GS_OPERATING_SYSTEM" v_GS_OPERATING_SYSTEM
v_GS_OPERATING_SYSTEM."ResourceID" = Computer_System_DATA."MachineID")
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"
Specific KB status:-
Select
c.BulletinID,
c.Title,
--d.CategoryInstanceName [UpdatesClassification],
--CASE((c.Severity))
CASE((b.Status))
v_CICategoryInfo_All d on d.CI_ID=c.CI_ID
where
--c.Title = '--'
c.ArticleID = '5004948'