2012-06-07 22 views
3

我正在創建一份報告以查找我們網絡上具有某些軟件的計算機。用於顯示軟件上次使用時間的Sccm報告

該報告工作正常,直到我想知道該程序何時上次使用。當我添加「LastUsedTime0」時,結果增加了。

我不是一個編碼器,我的腳本有很多腳本的試驗和錯誤,但它看起來像數據庫的鏈接不正確(從我的水晶報告體驗)。

這裏是腳本

=============================

SELECT s.Name0, DisplayName0, Publisher0, s.AD_Site_Name0, TopConsoleUser0, LastUsedTime0 

FROM v_Add_Remove_Programs arp,V_R_system s, 
v_FullCollectionMembership fcm, 
v_GS_CCM_RECENTLY_USED_APPS rua, 
v_GS_SYSTEM_CONSOLE_USAGE scu 

WHERE fcm.CollectionID = 'SMS00001' and 
arp.ResourceID=fcm.ResourceID and 
arp.ResourceID=s.ResourceID and 
arp.ResourceID=rua.ResourceID and 
arp.ResourceID=scu.ResourceID and 


(
DisplayName0 like 'Microsoft Office%' and 
DisplayName0 not like '%Excel%' and 
DisplayName0 not like '%database engine%' and 
DisplayName0 not like '%slide%' and 
DisplayName0 not like '%frontpage%' and 
DisplayName0 not like '%SharePoint%' and 
DisplayName0 not like '%Live%' and 
DisplayName0 not like '%PowerPoint%' and 
DisplayName0 not like '%Word%' and 
DisplayName0 not like '%XML%' and 
DisplayName0 not like '%Communicator%' and 
DisplayName0 not like '%SR-1%' and 
DisplayName0 not like '%Resource%' and 
DisplayName0 not like '%Visio%' and 
DisplayName0 not like '%Web%' and 
DisplayName0 not like '%XP%' and 
DisplayName0 not like '%Sounds%' and 
DisplayName0 not like '%OneNote%' and 
DisplayName0 not like '%Click%' and 
DisplayName0 not like '%Primary%' and 
DisplayName0 not like '%Standard%' and 
DisplayName0 not like '%Connector%' and 
DisplayName0 not like '%Pack%' and 
DisplayName0 not like '%Add-in%' and 
DisplayName0 not like '%Validation%' and 
DisplayName0 not like '%Components%' and 
DisplayName0 not like '%Proof%' and 
DisplayName0 not like '%MUI%' and 
DisplayName0 not like '%Service%' or 
DisplayName0 like 'Microsoft Project%' and 
DisplayName0 not like '%Pack%' and 
DisplayName0 not like '%MUI%' and 
DisplayName0 not like '%Service%' or 
DisplayName0 like 'Microsoft Access%' and 
DisplayName0 not like '%engine%' and 
DisplayName0 not like '%Runtime%' and 
DisplayName0 not like '%Standard%' and 
DisplayName0 not like '%Connector%' and 
DisplayName0 not like '%Pack%' and 
DisplayName0 not like '%Add-in%' and 
DisplayName0 not like '%Validation%' and 
DisplayName0 not like '%Components%' and 
DisplayName0 not like '%Proof%' and 
DisplayName0 not like '%MUI%' and 
DisplayName0 not like '%Service%' or 
DisplayName0 like 'Microsoft Project%' and 
DisplayName0 not like '%Pack%' and 
DisplayName0 not like '%MUI%' and 
DisplayName0 not like '%Trial%' and 
DisplayName0 not like '%Service%' or 
DisplayName0 like 'Microsoft Access%' and 
DisplayName0 not like '%engine%' and 
DisplayName0 not like '%MUI%' and 
DisplayName0 not like '%Service%' or 
DisplayName0 like 'Microsoft Visio%' and 
DisplayName0 not like '%Pack%' and 
DisplayName0 not like '%MUI%' and 
DisplayName0 not like '%Viewer%' and 
DisplayName0 not like '%Service%' 
) 

GROUP BY DisplayName0, Publisher0, s.AD_Site_Name0, s.Name0, LastUsedTime0, TopConsoleUser0 

ORDER BY Publisher0 

== =========================

這個腳本可能不是最好的方式來做我想做的事情,所以任何建議都會大。

感謝堆爲您的時間。

回答

1

加入你正在做技術性的工作,但會給你不正確的結果。這是一對多的關係,這就是爲什麼你看到「重複」。

添加/刪除程序數據與執行數據無關。它與機器相關,而機器又與執行數據有關。但是沒有直接的關係。

添加/刪除程序數據是安裝程序時(通常)在Windows中寫入註冊表的數據。執行數據由SCCM客戶端的軟件測量部分收集。它監視.exe文件的執行情況。 .exe文件不一定是添加/刪除程序中的程序,添加/刪除程序中的程序可能有多個與其相關的可執行文件。這就是您的查詢返回錯誤結果的原因。

從v_GS_CCM_RECENTLY_USED_APPS獲取所有數據並從查詢中刪除添加/刪除程序可能會更好。 v_GS_CCM_RECENTLY_USED_APPS中有一個產品名稱列,它有執行數據。