Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn
myITforum.com, Powered by You.
you are not logged in

Articles

Newslinks

Links

Downloads

Site Services

Community Forums

Discussion Lists

Article Search

Newsletter

Web Blogs

FAQs

Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us

Register

Login

BRONZE PARTNER:

BRONZE PARTNER:



Industry News:




  Home : Articles : SMS 2.x print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
SMS Query for Count of Clients per site that have discovery information within one week


Bookmark and Share

By: Jim Rothe
Posted On: 8/8/2003

These queries were created for during a conversion period when systems were being changed out regularly and we needed an accurate count of systems per site.

This first one eturns all clients (including servers) at a site:


SELECT DISTINCT
SITE.SiteCode AS 'Site Code',
SITE.SiteName AS 'Site Name',
COUNT(Instl.SMS_Installed_Sites0) AS 'Number of Clients Installed'
FROM
v_Site SITE
INNER JOIN
v_RA_System_SMSInstalledSites Instl
ON SITE.SiteCode = Instl.SMS_Installed_Sites0
INNER JOIN
v_AgentDiscoveries AGENT
ON Instl.ResourceID = AGENT.ResourceID
WHERE (7 >= DATEDIFF(DAY, AGENT.AgentTime, GETDATE()))
AND (AGENT.AgentName <> 'SMS_WINNT_SERVER_DISCOVERY_AGENT')
GROUP BY SITE.SiteCode, SITE.ReportingSiteCode, SITE.SiteName
ORDER BY SITE.SiteCode


This second one returns only the workstations (because the logon installation never runs on our servers)


SELECT DISTINCT
SITE.SiteCode AS 'Site Code',
SITE.SiteName AS 'Site Name',
COUNT(Instl.SMS_Installed_Sites0) AS 'Number of Clients Installed'
FROM
v_Site SITE
INNER JOIN
v_RA_System_SMSInstalledSites Instl
ON SITE.SiteCode = Instl.SMS_Installed_Sites0
INNER JOIN
v_AgentDiscoveries AGENT
ON Instl.ResourceID = AGENT.ResourceID
WHERE (7 >= DATEDIFF(DAY, AGENT.AgentTime, GETDATE()))
AND (AGENT.AgentName = 'NT Logon Discovery')
GROUP BY SITE.SiteCode, SITE.ReportingSiteCode, SITE.SiteName
ORDER BY SITE.SiteCode


Finally here is the XML statement I used for the query that allows you to drill through to the systems at that site.


<Node ID="N7023" Desc="List of Client Counts by Site Code" A="1" CatID="3" F="0" SP="usp_SMSR7023" HS="0" SD="none" HDT="1" DTQ="3016" FP="none" Type="0" G="0" V="1" />


If you notice the drill through uses 3016 which is the same stored procedure used by the "Clients by site" dashboard view as a drill through.

  myITforum.com ©2010 | Legal | Privacy