SMS 2003 Report – Show computers in given AD site
From the archive (2009). Written for the tools of the time, so some details may be out of date.
I wrote this report a long time ago, however i saw it pop up in a distribution list today so figured I’d post it. I’m not a SQL guru, but this should work.
Main Query:
SELECT DISTINCT SYS.Name0,SYS.AD_Site_Name0,
SYS.User_Domain0,SYS.User_Name0,
SYS.Operating_System_Name_and0
FROM v_R_System SYS
WHERE SYS.AD_Site_Name0 LIKE @variable
ORDER BY SYS.Name0
Prompt:
begin
if (@__filterwildcard = ”)
SELECT DISTINCT SYS.AD_Site_Name0 FROM v_R_System SYS ORDER BY SYS.AD_Site_Name0
else
SELECT DISTINCT SYS.AD_Site_Name0 FROM v_R_System SYS
WHERE SYS.AD_Site_Name0 like @__filterwildcard
ORDER BY SYS.AD_Site_Name0
End