SCCM SQL Query ~
Can you provide me to find the the login hours of particular user name using SQL query.
Thanks
Logon hours is an AD attribute and is not stored in CM07.
If however you are asking when did someone logon to a PC. This info is not stored by CM07 and again you should query ad for this info.
http://www.enhansoft.com/
Similar Messages
-
Need a SCCM SQL Query Report for Installed Software with Packages and Applications.
I need a report that will show the number of installs of all of the workstations applications and packages over a given period of time.
This will let us know how effective our deployments are and how well the on-demand software is being adopted.
Any help?Your Install Source might be an option as most SCCM deployments will install from C:\Windows\ccmcache\xx [where xx is a random folder name]. Most software vendors will put an install source in the registry, but not all do, so it won't be completely accurate.
When software is installed manually, the install source path won't be C:\Windows\ccmcache\xx.
Here is a SQL query I have for Install Source:
SELECT v_GS_COMPUTER_SYSTEM.Name0 as 'Computer Name', v_GS_INSTALLED_SOFTWARE.ProductName0 as 'Software Title', v_GS_INSTALLED_SOFTWARE.InstallSource0 as 'Install Source', v_GS_INSTALLED_SOFTWARE.ProductVersion0 as 'Version', v_GS_INSTALLED_SOFTWARE.InstalledLocation0
as 'Installed Location', v_GS_INSTALLED_SOFTWARE.InstallDate0 as 'Install Date'
FROM v_GS_COMPUTER_SYSTEM INNER JOIN v_GS_INSTALLED_SOFTWARE ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_INSTALLED_SOFTWARE.ResourceID
WHERE v_GS_INSTALLED_SOFTWARE.ProductName0 like '%Office 365 Pro%'
ORDER BY v_GS_COMPUTER_SYSTEM.Name0 -
SCCM sql query Client status if active or not in specific Collection
I would like to create an sql report to show if config manager client is active or not in specific Collection
, im using the query belong to "ManoharPusala"
Thank you so much which is
SELECT S.Name0 as 'Computer Name', S.User_Name0 as 'User Name',Case when CS.ClientActiveStatus='1' then
'Active' When CS.ClientActiveStatus='0' then 'Inactive' end as 'Client Active Status' FROM v_R_System S inner Join v_CH_ClientSummary CS on S.ResourceId=CS.ResourceID
is working as well but i want to modify it to query form a specific Collection
, please help me .
ThanksHi,
Please try to add "Join _RES_COLL_collectionID as coll on s.Name0=coll.name" to the end of the query.
SELECT S.Name0 as 'Computer Name', S.User_Name0 as 'User Name',Case when CS.ClientActiveStatus='1' then 'Active' When CS.ClientActiveStatus='0' then 'Inactive' end as 'Client Active Status' FROM v_R_System S inner Join v_CH_ClientSummary CS on S.ResourceId=CS.ResourceID join _RES_COLL_PRI0000A as coll on S.Name0=coll.name
Best Regards,
Joyce -
SCCM sql query Client status if active or not
I would like to create an sql report to show if config manager client is active or not, right now I query
v_R_System, for installed client. Any guidance on which table to query for active or not active clients would be helpful.I had the same question. I found that this query does what I wanted. You can certainly change the number of days since LastHardwareScan.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ResourceId in (select SMS_R_System.ResourceID from
SMS_R_System inner join SMS_G_System_WORKSTATION_STATUS on SMS_G_System_WORKSTATION_STATUS.ResourceID = SMS_R_System.ResourceID where DATEDIFF(dd,SMS_G_System_WORKSTATION_STATUS.LastHardwareScan,GetDate()) < 90)
I hope this helps :) -
Help needed for SCCM SQL query
Hello.
I have the below query to extract the workstations build date as well as the hardware info. This works fine.
Select distinct
v_R_System.Name0,
v_GS_COMPUTER_SYSTEM.Manufacturer0,
v_GS_COMPUTER_SYSTEM.Model0,
v_GS_COMPUTER_SYSTEM_PRODUCT.Version0,
v_GS_OPERATING_SYSTEM.Caption0,
v_GS_OPERATING_SYSTEM.CSDVersion0,
v_GS_OPERATING_SYSTEM.InstallDate0
From v_R_System
LEFT JOIN v_GS_OPERATING_SYSTEM ON v_GS_OPERATING_SYSTEM.ResourceID=v_R_System.ResourceID
LEFT JOIN v_GS_COMPUTER_SYSTEM_PRODUCT ON v_GS_COMPUTER_SYSTEM_PRODUCT.ResourceID=v_R_System.ResourceID
LEFT JOIN v_GS_COMPUTER_SYSTEM ON v_GS_COMPUTER_SYSTEM.ResourceID=v_R_System.ResourceID
LEFT JOIN v_GS_SYSTEM_CONSOLE_USAGE ON v_R_System.ResourceID=v_GS_SYSTEM_CONSOLE_USAGE.ResourceID
Where v_GS_OPERATING_SYSTEM.Caption0 = 'Microsoft Windows 7 Enterprise' and v_R_System.Is_Virtual_Machine0 =0
order by v_GS_OPERATING_SYSTEM.InstallDate0 desc
Now, I want a report of count of machines built based on "v_GS_COMPUTER_SYSTEM_PRODUCT.Version0" against every month and year of "v_GS_OPERATING_SYSTEM.InstallDate0".
For example, I want to know the number of machines under a particular model (which appears under v_GS_COMPUTER_SYSTEM_PRODUCT.Version0) built in June 2014. In this fashion I want a report for every model count for every month and year available under
InstallDate0 column)
Example:
Jan 2013 -> ThinkCentre M92p -> 55
Jan 2013 -> ThinkCentre M93 -> 40
Feb 2013 -> ThinkCentre M92p -> 10
Feb 2013 -> ThinkCentre M93 -> 39
Jan 2014 -> ThinkCentre M92p -> 20
Jan 2014 -> ThinkCentre M93 -> 25
Feb 2014 -> ThinkCentre M92p -> 12
Feb 2014 -> ThinkCentre M93 -> 35
Can anyone help?After scratching my head a bit, I came up with the below. Do you find any flaw in it?
Select
v_GS_COMPUTER_SYSTEM.Manufacturer0 as Manufacturer,
v_GS_COMPUTER_SYSTEM.Model0 as Model,
v_GS_COMPUTER_SYSTEM_PRODUCT.Version0 as "Model Info",
COUNT(*) as "No. of machines built",
CASE WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '1' THEN 'January'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '2' THEN 'February'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '3' THEN 'March'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '4' THEN 'April'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '5' THEN 'May'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '6' THEN 'June'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '7' THEN 'July'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '8' THEN 'August'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '9' THEN 'September'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '10' THEN 'October'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '11' THEN 'November'
WHEN Month(v_GS_OPERATING_SYSTEM.InstallDate0) = '12' THEN 'December'END as "Month",
YEAR(v_GS_OPERATING_SYSTEM.InstallDate0) as "Year"
From v_GS_COMPUTER_SYSTEM
LEFT JOIN v_GS_OPERATING_SYSTEM ON v_GS_OPERATING_SYSTEM.ResourceID=v_GS_COMPUTER_SYSTEM.ResourceID
LEFT JOIN v_GS_COMPUTER_SYSTEM_PRODUCT ON v_GS_COMPUTER_SYSTEM_PRODUCT.ResourceID=v_GS_COMPUTER_SYSTEM.ResourceID
Where v_GS_OPERATING_SYSTEM.Caption0 = 'Microsoft Windows 7 Enterprise' Group By v_GS_COMPUTER_SYSTEM.Manufacturer0,
v_GS_COMPUTER_SYSTEM.Model0,
v_GS_COMPUTER_SYSTEM_PRODUCT.Version0,
Month(v_GS_OPERATING_SYSTEM.InstallDate0),
YEAR(v_GS_OPERATING_SYSTEM.InstallDate0)
Order by v_GS_COMPUTER_SYSTEM_PRODUCT.Version0 desc -
Hi,
how to find using SCCM SQL query, application deployed on win 7 machines with SCCM 2012 server or user/technician installed manually. Please let me know.Thanks, is it not possible via any script also?
Like Torsten said, how can you tell the difference between CM12 installed applications and locally installed? Once you can answer that, then you can write report.
Garth Jones | My blogs: Enhansoft and
Old Blog site | Twitter:
@GarthMJ -
Hi guys, I have the below query which lists all the collections and their members, however I need to expand it to also include the OS, Service Pack, IP and if it's a physical or virtual machine.
I've tried a few things but only made it worse. Is anyone able to expand the below code to include those extras??
SELECT
v_FullCollectionMembership.CollectionID AS 'CollID',
v_Collection.Name AS 'CollName',
v_FullCollectionMembership.Name AS 'SystemName'
FROM
v_FullCollectionMembership, v_Collection
WHERE v_FullCollectionMembership.CollectionID = v_Collection.CollectionID
ORDER BY
CollID ASC, SystemName ASCHi,
These requirements could be found in several threads or blogs. We need convert WQL to SQL, and you can involve SQL guys to integrate the statements and format the result.
How to create a all virtual machines collection.
SCCM SQL Query - IP Address
ConfigMgr Systems without Current Service Packs, and System Patch Status -
SQL query to get the without SCCM agent for a Server
Hello every one,
Can I get the SQL query for a server without a SCCM agent .Here you go!!
Add the version for windows 2012 server if you have them as well in your environment
v_R_System.Netbios_Name0
,v_R_System.Full_Domain_Name0
,v_R_System.User_Name0
,case
When v_R_System.Operating_System_Name_and0 LIKE N'%Server 6.1'THEN 'Windows Server 2008 R2'
When v_R_System.Operating_System_Name_and0 LIKE N'%Server 6.0'THEN 'Windows Server 2008'
When v_R_System.Operating_System_Name_and0 LIKE N'%Server 5.2'THEN 'Windows Server 2003 R2'
ELSE 'Unknown Version' END AS 'OS version'
FROM
v_R_System
WHERE
v_R_System.Operating_System_Name_and0 LIKE N'%server%' and v_R_System.Client0 is null
Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. Delphin -
SCCM 2007 R2 - SQL query to know the compliance status of the client machines.
Hi All,
Can some one share the SQL query that will show the compliance of a "All systems" collection in SCCM 2007 R2 for past six months. I know that it is possible to get the reports from SCCM reporting but would like to run it from database.
Rgs,In SQL queries used in the reports we have prompts and hence I wanted avoid that.
What wrong with either removing the prompts from the query or hard coding the prompt data?
Garth Jones | My blogs: Enhansoft and
Old Blog site | Twitter:
@GarthMJ -
SQL Query (Migrating report from SMS 2003 and SCCM 2012R2)
Hello everyone,
I solicit you because I have to work on migrating reports from SMS 2003 and SCCM 2012 R2.
The following SQL query causes me some problems:
SELECT DISTINCT SYS.Netbios_Name0 AS Computer, (SELECT SUM(ProcAddtl.NumberOfLogicalProcessors0) FROM v_GS_Processor_Addtl0 ProcAddtl WHERE ProcAddtl.ResourceID=SYS.ResourceID) [Cores], CS.NumberOfProcessors0 AS CPU, CPU.MaxClockSpeed0 As Speed, CPU.Name0, MEMORY.TotalPhysicalMemory0/1024 AS [RAM Mb], (SELECT LDISKS.Name0 + '=' + CONVERT(varchar(15), LDISKS.Size0/1024) + ' | ' as 'data()' FROM v_GS_LOGICAL_DISK LDISKS WHERE LDISKS.ResourceID=SYS.ResourceID AND (LDISKS.Name0='C:' OR LDISKS.Name0='D:') ORDER BY LDISKS.Name0 FOR xml path('')) [Logical Disk (Gb)], (SELECT LDISKS.Name0 + '=' + CONVERT(varchar(15), LDISKS.FreeSpace0/1024) + ' | ' as 'data()' FROM v_GS_LOGICAL_DISK LDISKS WHERE LDISKS.ResourceID=SYS.ResourceID AND (LDISKS.Name0='C:' OR LDISKS.Name0='D:') ORDER BY LDISKS.Name0 FOR xml path('')) [Free Space(Gb)],CS.Manufacturer0 AS Manufacturer, CS.Model0, OS.Caption0 AS 'OS', (SELECT CONVERT(varchar(10), NIC.Index0) + '=' + NIC.IPAddress0 + ' | ' as 'data()' FROM v_GS_NETWORK_ADAPTER_CONFIGUR NIC WHERE NIC.ResourceID=SYS.ResourceID FOR xml path('')) [Network], (SELECT Count(Name0) FROM v_GS_SCSI_CONTROLLER SCSI WHERE SCSI.ResourceID=SYS.ResourceID AND SCSI.Name0 Like '%Qlogic%') [# FC HBA], INFONOYAU.RoleServeur0 AS Role, INFONOYAU.Zone0 AS Zone
FROM v_R_System SYS
LEFT JOIN v_GS_COMPUTER_SYSTEM CS ON CS.ResourceID = SYS.ResourceID
LEFT JOIN v_GS_PROCESSOR CPU ON CPU.ResourceID = SYS.ResourceID
LEFT JOIN v_GS_X86_PC_MEMORY MEMORY ON MEMORY.ResourceID = SYS.ResourceID
LEFT JOIN v_GS_OPERATING_SYSTEM OS ON OS.ResourceID = SYS.ResourceID
LEFT JOIN v_GS_Informations_Noyau0 INFONOYAU ON INFONOYAU.ResourceID = SYS.ResourceID
LEFT JOIN v_FullCollectionMembership COL ON COL.ResourceID = SYS.ResourceID
WHERE COL.CollectionID = @CollectionID ORDER BY SYS.Netbios_Name0
Can a charitable soul help me to migrate this query to a SCCM 2012R2 report?The following SQL query causes me some problems:
Why? What's happening?
Torsten Meringer | http://www.mssccmfaq.de -
SCCM 2012 All Updates report sql query
Need build sql query for report about all MS Updates like SCCM configuration manager view in window by path:
\Software Library\Overview\Software Updates\All Software Updates.
But I can't find fields that can show "product" (OS that use this patch) and size of each patch in SCCM and WSUS databases. Can anybody help me?To get file size I create query for files in package:
SELECT distinct ui.Title, ui.InfoURL, ui.DatePosted,
cf.FileName, cast(cast(cf.FileSize as real)/1024/1024 as decimal(10,2)) as SizeMb, uds.AssignmentName, uds.StartTime
FROM CI_ContentFiles cf
INNER JOIN v_UpdateContents uc ON cf.Content_ID = uc.Content_ID
INNER JOIN v_UpdateInfo ui ON uc.CI_ID = ui.CI_ID
INNER JOIN vSMS_UpdateDeploymentSummary uds ON ui.CI_ID = uds.CI_ID
join CI_ContentPackages cp on cf.Content_ID=cp.Content_ID
join CI_Contents co on co.Content_ID = cp.Content_ID
Where PkgID='MKL00032'
order by ui.InfoURL -
SCCM collection Query - Wrong output
Hi
We are working on Creating Dynamic SCCM collection which get populated based on following two condition
1) Belongs to a Test OU in AD
2) Doesn't have scom agent installed
We have been trying to work out why following query doesn't populate collection with correct object instead populate by every object that exist in this OU. Seems like condition after AND is totally ignored. is there anything I am doing wrong here
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceID =
SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "AD.local/Servers/DEV/Test" and SMS_G_System_SERVICE.DisplayName != "Microsoft Monitoring Agent"
Where as below query is working and condition after AND is calculated and collection get populated with right objects.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceID =
SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "AD.MONASH.EDU/Managed/Servers/DEV/OCIO/SplunkTest" and SMS_G_System_SERVICE.DisplayName = "Microsoft Monitoring Agent"
We tried with different combination such as "not like", "is null" etc etc. seems to us that as soon as we try have negative criteria after AND that criteria has been ignored.
To my little knowledge of SQL query, condition after AND is not optional and has to meet, if it doesn't query should return no value.
is this same with SCCM collection query? will appreciate if some one can shade some light here.
Thank you in advance.Thank you All for the reply
Our End Goal is to be able to automate software/configuration deployment based on criteria we set. SCOM is first of the rank if you like and we want this to be hands off approach so when a server move into certain OU based on criteria server get populated
into SCCM collection and SCCM pushes out software/configuration packages out to the server.
but having said that if we have to create two collection to satisfy our two criteria than most likely we will need number of collections depending on numbers and types of criteria. This will make managing collection and their relationship more challenging
and not sure if that is the path we want to take. This will need to be discussed through unless we find better solution.
Thank you again -
SQL query to list the "Administrative category" field for all applications
yesterday i started a thread to list the "Optional reference" field for all cm applications in a SSRS report. I've got the query with the help of Torsten.
https://social.technet.microsoft.com/Forums/en-US/00419e6e-e3c2-4b80-b6af-2a24ced1032d/sql-query-to-list-the-optional-reference-field-of-all-packages-in-cm-2012?forum=configmanagersdk
But again today, i'm looking for a way to get "Administrative category" field in a SSRS report. Could someone point me to the right direction ?
Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. DelphinHi,
You could monitor the SMSProv.log when you check the category of an application. It shows that SQL query the SCCM provider used is related to function fn_ListCategoryInstances.
Best Regards,
Joyce -
SQL query to fetch the catalog category for a PLM item
Hi All,
Can anyone help me with a sql query of how we can fetch the catalog category for a PLM item.
Regards,
ShrutiHi,
You could monitor the SMSProv.log when you check the category of an application. It shows that SQL query the SCCM provider used is related to function fn_ListCategoryInstances.
Best Regards,
Joyce -
SQL query to pull all systems with USB printer attached
I am looking to create a SQL query for a collection that will populate the systems at my site that have a USB printer attached. I saw I could query the USB device, Manufactuer and then include several OR statements for the various printer types we
have on site. I also found under USB device, Service that I could select a usbprint value. I found a few other technet posts that had to do with SCCM 2007 and printers.
I have the following Query statement:
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_USB_DEVICE on SMS_G_System_USB_DEVICE.ResourceId
= SMS_R_System.ResourceId where SMS_G_System_USB_DEVICE.Service = "usbprint"
The collection pulled in several systems that appear to also have local USB attached printers but I am just seeking further understanding that by searching on the usbprint service I should pick up any system that has any USB device attached that reports
it has the ability to print. Am I understanding this correctly?Yes, I know this is an old post, but I’m trying to clean them up. Did you solve this problem, if so what was the solution?
Yes basically your understand is correct.
Garth Jones | My blogs: Enhansoft and
Old Blog site | Twitter:
@GarthMJ
Maybe you are looking for
-
How does one take a PDF document and transfer it to a Word Power Point doc?
I have signed up for yearly plan with Adobe. And cannot figure out how to take my PDF doc and transfer it to a Power Point doc? Any help would so be appreciated. Thanks!
-
PLAY ALL - simple? Or no?
Simple SD dvd, 3 tracks, one = 79 min, 1 = 3 min, 1 = 4 min...client also wants a PLAY ALL button. It's about 4.4 GB now. How do I make a PLAY ALL option without causing problems for the end jump on the tracks? How to make a PLAY ALL button/option? T
-
Hi Can any one explain about Intercomany Vendor Order order currency maintenance procedure ? Also the situation many intercomany vendor...how to maintain the order currency ? same type or different as per vendor requirement. Regards RG
-
hi i am making pmt to vendor through app,while doing proposal run,the message is displaying that proposal has been schedule and job was cancelled can anybody help me guna
-
Sample rate of cio-das08j​r
hello; after an internet search. and reading the help, I still post on this forum, hoping that I find an answer; At first, I realized the aquisiion using cio-das08 Jr. with the help of someone on this forum (cj), I thought I solved the problem by tha