<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Empty Garden</title>
	<atom:link href="http://emptygarden.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://emptygarden.info</link>
	<description>Planting seeds of knowledge so that your brain can grow.</description>
	<lastBuildDate>Thu, 21 Mar 2013 13:02:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='emptygarden.info' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Empty Garden</title>
		<link>http://emptygarden.info</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://emptygarden.info/osd.xml" title="The Empty Garden" />
	<atom:link rel='hub' href='http://emptygarden.info/?pushpress=hub'/>
		<item>
		<title>Config Manger 2012 SDK&#8211;Prerelease</title>
		<link>http://emptygarden.info/2012/06/19/config-manger-2012-sdkprerelease/</link>
		<comments>http://emptygarden.info/2012/06/19/config-manger-2012-sdkprerelease/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 14:39:32 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=132</guid>
		<description><![CDATA[http://www.microsoft.com/en-us/download/details.aspx?id=29559<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=132&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a title="http://www.microsoft.com/en-us/download/details.aspx?id=29559" href="http://www.microsoft.com/en-us/download/details.aspx?id=29559">http://www.microsoft.com/en-us/download/details.aspx?id=29559</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=132&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/06/19/config-manger-2012-sdkprerelease/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Holy Cow&#8211;PDF technical documentation for the entire System Center suite</title>
		<link>http://emptygarden.info/2012/06/19/holy-cowpdf-technical-documentation-for-the-entire-system-center-suite/</link>
		<comments>http://emptygarden.info/2012/06/19/holy-cowpdf-technical-documentation-for-the-entire-system-center-suite/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 14:38:58 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=130</guid>
		<description><![CDATA[http://www.microsoft.com/en-us/download/search.aspx?q=Technical%20Documentation%20Download%20for%20System%20Center%20<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=130&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a title="http://www.microsoft.com/en-us/download/search.aspx?q=Technical%20Documentation%20Download%20for%20System%20Center%20" href="http://www.microsoft.com/en-us/download/search.aspx?q=Technical%20Documentation%20Download%20for%20System%20Center%20">http://www.microsoft.com/en-us/download/search.aspx?q=Technical%20Documentation%20Download%20for%20System%20Center%20</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=130&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/06/19/holy-cowpdf-technical-documentation-for-the-entire-system-center-suite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Notes from the Minnesota System Center Users Group</title>
		<link>http://emptygarden.info/2012/06/19/notes-from-the-minnesota-system-center-users-group/</link>
		<comments>http://emptygarden.info/2012/06/19/notes-from-the-minnesota-system-center-users-group/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 14:11:59 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=128</guid>
		<description><![CDATA[&#160; Last Friday at the Minnesota System Center Users Group I had the pleasure of seeing Wally Mead speak! His session lasted about three hours and he covered Config Manger 2012 SP1. Configuration Manger 2012 – SP1 – probably won’t &#8230; <a href="http://emptygarden.info/2012/06/19/notes-from-the-minnesota-system-center-users-group/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=128&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h4>&nbsp;</h4>
<h4>Last Friday at the <a href="http://www.mnscug.org/">Minnesota System Center Users Group</a> I had the pleasure of seeing Wally Mead speak! His session lasted about three hours and he covered Config Manger 2012 SP1.</h4>
<ul>
<li><b>Configuration Manger 2012 – SP1 – </b>probably won’t be released until Windows 8 is released.
<li><b></b>
<li><b>Windows 8</b>
<ul>
<ul>
<li>No more WAIK.
<li>WAIK is replaced by the ADK (Assessment and Deployment Kit) – ADK is a separate download</li>
</ul>
</ul>
<li>Adding support for UEFI-32 and 64 bit
<ul>
<ul>
<li>This is the thing that happens between BIOS and CTRL-ALT-DEL or something like that!</li>
</ul>
</ul>
<li>Always on always connected (AOAC)
<ul>
<ul>
<li>Newer slate devices have this
<li>Helps preserve battery life</li>
</ul>
</ul>
<li>Configuration Mgr can no longer keep the OS from sleeping
<li>Configuration Mgr client behavior was adapted to be a good citizen to act differently in these new states
<ul>
<ul>
<li>On battery only
<li>Configuration manager will not perform non-end user initiated tasks, unless those tasks were missed/overdue
<li>On AC – normal Configuration Manger behavior
<li>Network connected
<li>No network – Configuration manger won’t attempt tasks that require network
<li>Windows maintenance hour
<ul>
<li>Configuration Manger can take advantage of this new feature in Windows 8</li>
</ul>
</li>
</ul>
</ul>
<li>New deployment type for METRO Apps.
<li>
<li><b>Deep Links</b>
<ul>
<ul>
<li>End user goes to the Configuration Mgr 2012 Application Catalog. An application can be configured to download from the Windows Store
<li>Thus, the SCCM admin does not need to repackage an application.
<li>The downside is that instead of using a local DP for the content, the content will be hosted online.</li>
</ul>
</ul>
<li>
<li>Configuration Mgr SP1 can manage
<ul>
<ul>
<li>Windows 8 Client Side Caching, Roaming User Profiles, Folder Redirection</li>
</ul>
</ul>
<li>
<li><b>Network Cost Support (only Windows 8 clients)</b>
<ul>
<ul>
<li>Configuration Manger can block network traffic if the Windows 8 machine is on a 3G or 4G network.</li>
</ul>
</ul>
<li>
<li><b>Windows To Go</b>
<ul>
<ul>
<li>Configuration Mgr can create and provision a Windows-To-Go device</li>
</ul>
</ul>
<li>
<li><b>New Platform Support</b>
<ul>
<ul>
<li>Supports more Nokia devices (E6, Nokia 701, Nokia C7, N8, Nokia 603)
<li>Apple Mac OS
<ul>
<li>Supports 10.6 (snow leopard) and 10.7 (lion)
<li>Hardware Inventory, Software Dist, Software updates, settings management</li>
</ul>
</li>
</ul>
</ul>
<li>
<li>Endpoint protection
<ul>
<li>Linux client support
<li>Linux server support</li>
</ul>
<li>
<li><b>Feature Improvements</b>
<ul>
<ul>
<li>Can add a Central Administration Site (CAS) later
<li>Configuration Manger 2012 to Configuration Mgr 2012 migration
<ul>
<li>Scenario: you have two primary 2012 sites. You can only attach ONE of them to the new CAS. You would need to build another 2012 site and attach it to the CAS. Then you could migrate the standalone 2012 site to the newly attached one.
<li>Scenario: lab to production</li>
</ul>
<li>Granular control over SQL Server Replication </li>
</ul>
</ul>
<li>
<li><b>Server Infrastructure Support</b>
<ul>
<ul>
<li>Exchange connector support
<ul>
<li>E14 SP2
<li>E15</li>
</ul>
</li>
</ul>
</ul>
<li>
<li>SQL Server 2012 support (only for Configuration Mgr SP1)
<li>
<li><b>End User Client UI improvements</b>
<ul>
<ul>
<li>Software Center supports multi-select
<li>No more ActiveX control – it now depends on Silverlight 5</li>
</ul>
</ul>
<li>
<li><b>OS Deployment Improvements</b>
<ul>
<ul>
<li>Prestage media now supports additional content types
<ul>
<li>Before: WIM only
<li>Now: WIM, applications, drives, package / programs</li>
</ul>
<li>Task Sequences can now be applicable to WinPE only</li>
</ul>
</ul>
<li>
<li><b>Endpoint Protection</b>
<ul>
<ul>
<li>Automatically deploy definition updates 3 times per day
<li>Real time actions
<li>Run Definition updates
<li>Run Quick Scan
<li>Run Full Scan
<li>Allow threats
<li>Exclude paths and / or files</li>
</ul>
</ul>
<li>
<li><b>App-V</b>
<ul>
<ul>
<li>App-V 4.6 SP2 support (this is needed for Windows 8 support)
<li>App-V 5.0 support</li>
</ul>
</ul>
<li>
<li><b>PowerShell support</b>
<ul>
<ul>
<li>PowerShell provider</li>
</ul>
</ul>
<li>
<li><b>Alerts</b>
<ul>
<ul>
<li>All alerts support email notification
<li>Admin can choose to ignore specific types of alerts</li>
</ul>
</ul>
<li>
<li><b>Software updates</b>
<ul>
<ul>
<li>If the client is Internet based and can’t get their updates from the SUP they can be configured to go to Windows Update</li>
</ul>
</ul>
<li>
<li>Configuration Manger 2012 SDK comes out at the end of June 2012</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=128&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/06/19/notes-from-the-minnesota-system-center-users-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 8 with Hyper-V</title>
		<link>http://emptygarden.info/2012/06/19/system-center-documentation-in-pdf/</link>
		<comments>http://emptygarden.info/2012/06/19/system-center-documentation-in-pdf/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 13:50:56 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=124</guid>
		<description><![CDATA[Last Friday at the Minnesota System Center Users Group I had the pleasure of seeing Wally Mead speak!&#160; I noticed that Wally had Windows 8 on his laptop, but he was also using Virtual Machines.&#160; I asked him if those &#8230; <a href="http://emptygarden.info/2012/06/19/system-center-documentation-in-pdf/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=124&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Last Friday at the <a href="http://www.mnscug.org/">Minnesota System Center Users Group</a> I had the pleasure of seeing Wally Mead speak!&nbsp; I noticed that Wally had Windows 8 on his laptop, but he was also using Virtual Machines.&nbsp; I asked him if those were Hyper-V machines and he said yes.&nbsp; At this point I was confused!&nbsp; He told me that Windows 8 has a Hyper-V feature.&nbsp; He went on to say that Windows 8 is the first client OS he has had on his laptop in a long time, since before he had to use a server OS.</p>
<p>I can’t wait to throw Windows 8 on my new <a href="http://www.malibal.com/boutique/pc/configurePrd.asp?idProduct=523">Malibal Satori</a> laptop with 256GB mSATA drive (for the OS), three 750GB drives (two of which are RAID 0), 32 GB RAM, Intel Core i7-3920XM and (most importantly) a matte screen.&nbsp; Perhaps now Brian Mason (Config Manager MVP) will stop teasing me about my current EliteBook 2540p!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=124&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/06/19/system-center-documentation-in-pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>SCCM Client Inventory and WSUS Scan state</title>
		<link>http://emptygarden.info/2012/05/24/sccm-client-inventory-and-wsus-scan-state/</link>
		<comments>http://emptygarden.info/2012/05/24/sccm-client-inventory-and-wsus-scan-state/#comments</comments>
		<pubDate>Thu, 24 May 2012 16:41:25 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=122</guid>
		<description><![CDATA[Here is a view that you can use to see SCCM Client inventory and WSUS scan state information. CREATE view [dbo].[v_SCCM_Health_Check] as select distinct a.name0 as 'MachineName' , a.itemkey , a.operating_system_name_and0 as 'OperatingSystem' , os.CSDVersion0 as 'OS_ServicePack' , a.client0 as &#8230; <a href="http://emptygarden.info/2012/05/24/sccm-client-inventory-and-wsus-scan-state/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=122&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Here is a view that you can use to see SCCM Client inventory and WSUS scan state information.</p>
<pre class="csharpcode"><span class="kwrd">CREATE</span> <span class="kwrd">view</span> [dbo].[v_SCCM_Health_Check] <span class="kwrd">as</span>

<span class="kwrd">select</span> <span class="kwrd">distinct</span> a.name0 <span class="kwrd">as</span> <span class="str">'MachineName'</span>
, a.itemkey
, a.operating_system_name_and0 <span class="kwrd">as</span> <span class="str">'OperatingSystem'</span>
, os.CSDVersion0 <span class="kwrd">as</span> <span class="str">'OS_ServicePack'</span>
, a.client0 <span class="kwrd">as</span> <span class="str">'SCCM_Client'</span>
, a.Client_Version0 <span class="kwrd">as</span> <span class="str">'SCCM_ClientVersion'</span>
, <span class="kwrd">case</span> <span class="kwrd">when</span> a.User_Name0 <span class="kwrd">like</span> <span class="str">'%\%'</span> <span class="kwrd">then</span> <span class="kwrd">substring</span>(a.User_Name0,charindex(<span class="str">'\'</span>,a.User_Name0)+ 1,charindex(<span class="str">'\'</span>,a.User_Name0))
    <span class="kwrd">else</span> a.User_Name0 <span class="kwrd">end</span> <span class="kwrd">AS</span> <span class="str">'LastLoggedOnUser'</span>
, <span class="kwrd">case</span> <span class="kwrd">when</span> scud.TopConsoleUser0 <span class="kwrd">like</span> <span class="str">'%\%'</span> <span class="kwrd">then</span> <span class="kwrd">substring</span>(scud.TopConsoleUser0,charindex(<span class="str">'\'</span>,scud.TopConsoleUser0)+ 1,charindex(<span class="str">'\'</span>,scud.TopConsoleUser0)) 
    <span class="kwrd">else</span> scud.TopConsoleUser0 <span class="kwrd">end</span> <span class="kwrd">as</span> <span class="str">'MainUser'</span>
, nlp.FullName0 <span class="kwrd">as</span> <span class="str">'MainUserFullName'</span>
, a.AD_Site_Name0 <span class="kwrd">as</span> <span class="str">'AD_Site'</span>
, ou.OU
, a.Resource_Domain_OR_Workgr0 <span class="kwrd">as</span> <span class="str">'Domain'</span>
, e.SiteCode <span class="kwrd">as</span> <span class="str">'SCCM_Site_Code'</span>
, b.LastHWScan <span class="kwrd">as</span> <span class="str">'SCCM_LastHWscan'</span>
, c.LastUpdateDate <span class="kwrd">as</span> <span class="str">'SCCM_LastSWscan'</span>
, Dateadd(<span class="kwrd">hour</span>,(datediff(<span class="kwrd">hour</span>,getutcdate(),getdate())),d.lastscantime) <span class="kwrd">as</span> <span class="str">'Last_WSUSscan'</span>
, scan.StateName <span class="str">'WSUSscan_State'</span>
, scan.ErrorStatusID
, scan.ErrorCode
, scan.HexErrorCode
, uagent.version00 <span class="str">'WSUS_AgentVersion'</span>
, d.lastlocation <span class="kwrd">as</span> <span class="str">'WSUSserver'</span>
, CCMService.State0 <span class="kwrd">as</span> <span class="str">'SMS_Agent_Host_Service'</span>
, AutoUpdates.State0 <span class="kwrd">as</span> <span class="str">'Auto_Updates_Service'</span>
<span class="kwrd">from</span> SMS_CEN.dbo.System_DISC a 
<span class="kwrd">left</span> <span class="kwrd">join</span> SMS_CEN.dbo.WorkstationStatus_DATA b
<span class="kwrd">on</span> a.itemkey = b.machineid  
<span class="kwrd">left</span> <span class="kwrd">join</span> SMS_CEN.dbo.SoftwareInventoryStatus c
<span class="kwrd">on</span> a.itemkey = c.clientid  
<span class="kwrd">left</span> <span class="kwrd">join</span> SMS_CEN.dbo.Update_ScanStatus d
<span class="kwrd">on</span> a.itemkey = d.machineid 
<span class="kwrd">left</span> <span class="kwrd">join</span> SMS_CEN.dbo.Windows_Update_Agent__DATA uagent
<span class="kwrd">on</span> a.itemkey = uagent.machineid 
<span class="kwrd">left</span> <span class="kwrd">join</span> SMS_CEN.dbo.Sites_DATA e  
<span class="kwrd">on</span> a.itemkey = e.machineid  
<span class="kwrd">left</span> <span class="kwrd">join</span> dbo.SCCM_Health_Check_DATA f
<span class="kwrd">on</span> a.itemkey = f.machineid 
<span class="kwrd">left</span> <span class="kwrd">join</span> dbo.Operating_System_DATA os
<span class="kwrd">on</span> a.itemkey = os.machineid  
<span class="kwrd">left</span> <span class="kwrd">join</span>
(
<span class="kwrd">select</span> uss.ResourceID, SN.StateName, uss.LastStatusMessageID&amp;0x0000FFFF <span class="kwrd">as</span> ErrorStatusID,
    isnull(uss.LastErrorCode,0) <span class="kwrd">as</span> ErrorCode,
    dbo.fnConvertBinaryToHexString(<span class="kwrd">convert</span>(VARBINARY(8), isnull(uss.LastErrorCode,0))) <span class="kwrd">as</span> HexErrorCode
 <span class="kwrd">from</span> v_UpdateScanStatus uss
    <span class="kwrd">join</span> v_R_System rsys <span class="kwrd">on</span> rsys.ResourceID = uss.ResourceID <span class="kwrd">and</span> isnull(rsys.Obsolete0,0)&lt;&gt;1
    <span class="kwrd">join</span> v_SoftwareUpdateSource sus <span class="kwrd">on</span> uss.UpdateSource_ID = sus.UpdateSource_ID 
    <span class="kwrd">join</span> v_RA_System_SMSAssignedSites sass <span class="kwrd">on</span> uss.ResourceID = sass.ResourceID
    <span class="kwrd">join</span> v_StateNames sn <span class="kwrd">on</span> sn.TopicType = 501 <span class="kwrd">and</span> 
        sn.StateID = (<span class="kwrd">case</span> <span class="kwrd">when</span> (isnull(uss.LastScanState, 0)=0 <span class="kwrd">and</span> <span class="kwrd">Left</span>(isnull(rsys.Client_Version0, <span class="str">'4.0'</span>), 1)&lt;<span class="str">'4'</span>) <span class="kwrd">then</span> 7 <span class="kwrd">else</span> isnull(uss.LastScanState, 0) <span class="kwrd">end</span>)
) scan
<span class="kwrd">on</span> a.itemkey = scan.ResourceID  
<span class="kwrd">left</span> <span class="kwrd">JOIN</span> dbo.v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP SCUD
<span class="kwrd">on</span> a.itemkey = scud.resourceID
<span class="kwrd">left</span> <span class="kwrd">join</span> dbo.v_GS_NETWORK_LOGIN_PROFILE nlp
<span class="kwrd">on</span> nlp.name0 = scud.TopConsoleUser0 <span class="kwrd">and</span> nlp.resourceID = scud.resourceid
<span class="kwrd">left</span> <span class="kwrd">join</span>
    (
    <span class="kwrd">select</span> machineid, State0
    <span class="kwrd">from</span>     dbo.Services_DATA
    <span class="kwrd">where</span> name0 = <span class="str">'ccmexec'</span>
    ) CCMService
<span class="kwrd">on</span> a.itemkey = CCMService.machineid
<span class="kwrd">left</span> <span class="kwrd">join</span>
    (
    <span class="kwrd">select</span> machineid, State0
    <span class="kwrd">from</span>     dbo.Services_DATA
    <span class="kwrd">where</span> name0 = <span class="str">'wuauserv'</span>
    ) AutoUpdates
<span class="kwrd">on</span> a.itemkey = AutoUpdates.machineid
<span class="kwrd">left</span> <span class="kwrd">join</span>
    (
    <span class="kwrd">select</span> itemKey, <span class="kwrd">max</span>(system_ou_name0) <span class="kwrd">as</span> <span class="str">'OU'</span>
    <span class="kwrd">from</span> dbo.System_System_OU_Name_ARR
    <span class="kwrd">group</span> <span class="kwrd">by</span> itemkey
    ) OU
<span class="kwrd">on</span> a.itemkey = ou.itemkey</pre>
<p>.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, &#8220;Courier New&#8221;, courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt<br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=122&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/05/24/sccm-client-inventory-and-wsus-scan-state/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>TechFuseMN &#8211; 2012</title>
		<link>http://emptygarden.info/2012/05/16/techfusemn-2012/</link>
		<comments>http://emptygarden.info/2012/05/16/techfusemn-2012/#comments</comments>
		<pubDate>Thu, 17 May 2012 00:46:55 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=119</guid>
		<description><![CDATA[I will be speaking at TechFuseMN on Thursday May 17th.&#160; Here are links to a couple of the SCCM 2012 tools that I will be using. Right Click Tools -&#160; http://sms-hints-tricks.blogspot.com/2011/08/configmgr-2012-console-extensions.html More Right Click Tools (since I have no idea &#8230; <a href="http://emptygarden.info/2012/05/16/techfusemn-2012/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=119&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I will be speaking at <a href="http://www.benchmarklearning.com/Event/TechFuse/Default.aspx">TechFuseMN</a> on Thursday May 17th.&nbsp; </p>
<p>Here are links to a couple of the SCCM 2012 tools that I will be using.</p>
<p>Right Click Tools -&nbsp; <a title="http://sms-hints-tricks.blogspot.com/2011/08/configmgr-2012-console-extensions.html" href="http://sms-hints-tricks.blogspot.com/2011/08/configmgr-2012-console-extensions.html">http://sms-hints-tricks.blogspot.com/2011/08/configmgr-2012-console-extensions.html</a></p>
<p>More Right Click Tools (since I have no idea how to get the above one’s to work!)&nbsp;&nbsp; &#8211; <a title="http://eskonr.com/2012/05/sccm-2012-right-click-tools/" href="http://eskonr.com/2012/05/sccm-2012-right-click-tools/">http://eskonr.com/2012/05/sccm-2012-right-click-tools/</a></p>
<p>RegKeyToMOF &#8211; <a title="http://myitforum.com/cs2/files/folders/proddocs/entry152945.aspx" href="http://myitforum.com/cs2/files/folders/proddocs/entry152945.aspx">http://myitforum.com/cs2/files/folders/proddocs/entry152945.aspx</a></p>
<p>Config Manager 2012 Technet &#8211; <a title="http://technet.microsoft.com/en-us/library/gg682129" href="http://technet.microsoft.com/en-us/library/gg682129">http://technet.microsoft.com/en-us/library/gg682129</a></p>
<p>Config Manager 2012 Virtual Labs &#8211; <a title="http://technet.microsoft.com/en-us/systemcenter/bb539977" href="http://technet.microsoft.com/en-us/systemcenter/bb539977">http://technet.microsoft.com/en-us/systemcenter/bb539977</a></p>
<p>MMS2012 – FREE Content &#8211; <a title="http://www.mms-2012.com/" href="http://www.mms-2012.com/">http://www.mms-2012.com/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=119&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/05/16/techfusemn-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Powershell&#8211;Schedule a SCCM Advertisement</title>
		<link>http://emptygarden.info/2012/04/20/powershellschedule-a-sccm-advertisement/</link>
		<comments>http://emptygarden.info/2012/04/20/powershellschedule-a-sccm-advertisement/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 19:39:49 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=117</guid>
		<description><![CDATA[One of the business units I work with needed to deploy an application using SCCM.&#160; So far so good right?&#160; Then they said that they only wanted it to run between 23:00 and 06:00.&#160; So now you are thinking about &#8230; <a href="http://emptygarden.info/2012/04/20/powershellschedule-a-sccm-advertisement/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=117&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of the business units I work with needed to deploy an application using SCCM.&nbsp; So far so good right?&nbsp; Then they said that they only wanted it to run between 23:00 and 06:00.&nbsp; So now you are thinking about putting a Maintenance Window on the collection to accomplish the time restriction requirement right?&nbsp; Well, what about all of the other distributions (like Software Updates)?&nbsp; They wouldn’t run on the machines that are in the collection with the Maintenance Window on it.&nbsp; I guess we could go into each and every deployment and flag it to ignore maintenance windows, but that would cause even more headaches.</p>
<p>With a little help from PowerShell and SQL we can change the advertisement properties.&nbsp; Specifically we need to change the following:</p>
<ul>
<li>Advertisement Start Time</li>
<li>Advertisement Expires</li>
<li>Mandatory Assignments</li>
</ul>
<p>Example of what we need to accomplish:</p>
<ul>
<li>Today the Advertisement has the following settings</li>
<ul>
<ul>
<li>Advertisement Start Time – 4/20/2012&nbsp; 23:00.</li>
<li>Advertisement Expires – 4/21/2012 06:00</li>
<li>Mandatory Assignments – 4/20/2012 23:00</li>
</ul>
</ul>
</ul>
<ul>
<li>Tomorrow the Advertisement will have the following settings</li>
<ul>
<ul>
<li>Advertisement Start Time – 4/21/2012 23:00.</li>
<li>Advertisement Expires – 4/22/2012 06:00</li>
<li>Mandatory Assignments – 4/21/2012 23:00</li>
</ul>
</ul>
</ul>
<p>Well, I could go into the properties of the advertisement and change them, but that isn’t my style.</p>
<ul><!--EndFragment--></ul>
<p>What I did was write a PowerShell script to change the above times and then created a SQL Job to run the PowerShell script on a schedule.</p>
<p>PowerShell Script:</p>
<div style="margin:0;display:inline;float:none;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:4f13439d-ad63-4cfd-94a7-7988d943c6e2" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">Param([String[]] $AdvertisementID)

$SCCM_SERVER = "[server name without the brackets]"
$SCCM_SITECODE = "[three letter site code without brackets]"
#$AdvertisementID = "[AdvertisementID without the brackets]"

#Foreach ($AdvertisementID in $AdvertisementIDs)
#	{
	$AdvertisementSettings = ([WMIClass] "\\$SCCM_SERVER\root\SMS\site_$($SCCM_SITECODE):SMS_Advertisement").CreateInstance()
	$AdvertisementSettings.AdvertisementID = $AdvertisementID
	#Get lazy properties
	$AdvertisementSettings.Get()
	#Build the Scheduled Time
#	$NewDate = (Get-Date).adddays(1)
	$year = [string](Get-Date).Year
	$month = [String](Get-Date).Month
	if ($month.Length -eq 1) {$month = "0" + $month}
	$day = [string](Get-Date).Day
	if ($day.Length -eq 1) {$day = "0" + $day}
	$ScheduledTime = $year + $month + $day + "230000.000000+***"
	#Build the Expiration Time
	$ExpireDate = (Get-Date).AddDays(1)
	$day = [string]$ExpireDate.Day
	if ($day.Length -eq 1) {$day = "0" + $day}
	$ExpirationTime = $year + $month + $day + "060000.000000+***"	
	#Apply the settings to the advertisement
	$AdvertisementSettings.PresentTime = $ScheduledTime
	$AdvertisementSettings.ExpirationTime = $ExpirationTime
	$AdvertisementSettings.ExpirationTimeEnabled = $true
	$AdvertisementSettings.put()

	$AssignedSchedule = ([WMIClass] "\\$SCCM_SERVER\root\SMS\site_$($SCCM_SITECODE):SMS_ST_NonRecurring").CreateInstance() 
  $AssignedSchedule.StartTime = $ScheduledTime
  $AdvertisementSettings.AssignedSchedule = $AssignedSchedule
  $AdvertisementSettings.AssignedScheduleEnabled = $true
  $AdvertisementSettings.put() 
#	}</pre>
</div>
<ul>
<ul><!--EndFragment--></p>
<ul><!--EndFragment--></ul>
</ul>
</ul>
<p>Then we need to create a SQL Job to run this PowerShell script nightly:</p>
<div style="margin:0;display:inline;float:none;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c94bac7f-65e6-4d55-906c-d4caf103d33c" class="wlWriterEditableSmartContent">
<pre class="brush: sql;">USE [msdb]
GO

/****** Object:  Job [Job Name Here.  Keep the brackets]    Script Date: 04/20/2012 14:34:08 ******/
BEGIN TRANSACTION
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
/****** Object:  JobCategory [[Uncategorized (Local)]]]    Script Date: 04/20/2012 14:34:08 ******/
IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1)
BEGIN
EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'[Uncategorized (Local)]'
IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback

END

DECLARE @jobId BINARY(16)
EXEC @ReturnCode =  msdb.dbo.sp_add_job @job_name=N'Job name inside the ticks', 
		@enabled=1, 
		@notify_level_eventlog=0, 
		@notify_level_email=0, 
		@notify_level_netsend=0, 
		@notify_level_page=0, 
		@delete_level=0, 
		@description=N'No description available.', 
		@category_name=N'[Uncategorized (Local)]', 
		@owner_login_name=N'[Domain\UserName without the brackets]', @job_id = @jobId OUTPUT
IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback
/****** Object:  Step [CWT - Express 1.2 Advertisement]    Script Date: 04/20/2012 14:34:09 ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'Job step name inside the ticks', 
		@step_id=1, 
		@cmdexec_success_code=0, 
		@on_success_action=1, 
		@on_success_step_id=0, 
		@on_fail_action=2, 
		@on_fail_step_id=0, 
		@retry_attempts=0, 
		@retry_interval=0, 
		@os_run_priority=0, @subsystem=N'CmdExec', 
		@command=N'C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -command "&amp; ''I:\SCCMScripts\SCCM Powershell Production Scripts\Set-Advertisement.ps1'' -AdvertisementID ''[AdvertisementID without the brackets]''"', 
		@flags=0, 
		@proxy_name=N'[proxy name so that the job can execute]'
IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1
IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id=@jobId, @name=N'Job name inside the ticks', 
		@enabled=1, 
		@freq_type=4, 
		@freq_interval=1, 
		@freq_subday_type=1, 
		@freq_subday_interval=0, 
		@freq_relative_interval=0, 
		@freq_recurrence_factor=0, 
		@active_start_date=20120419, 
		@active_end_date=20120503, 
		@active_start_time=220000, 
		@active_end_time=235959, 
		@schedule_uid=N'2fd7b8b0-f749-4022-a806-3410372c6f4e'
IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name = N'(local)'
IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback
COMMIT TRANSACTION
GOTO EndSave
QuitWithRollback:
    IF (@@TRANCOUNT &gt; 0) ROLLBACK TRANSACTION
EndSave:

GO
</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=117&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/04/20/powershellschedule-a-sccm-advertisement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Moving the SMSSIG$ and SMSPKGSIG folders in SCCM</title>
		<link>http://emptygarden.info/2012/04/18/moving-the-smssig-and-smspkgsig-folders-in-sccm/</link>
		<comments>http://emptygarden.info/2012/04/18/moving-the-smssig-and-smspkgsig-folders-in-sccm/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 18:17:26 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=115</guid>
		<description><![CDATA[Just by reading the title of this post you can rest assured that the s**t hit the fan on one of my SCCM Primary Sites today!&#160; One of our drives was almost full and it turned out that the SMSSIG$ &#8230; <a href="http://emptygarden.info/2012/04/18/moving-the-smssig-and-smspkgsig-folders-in-sccm/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=115&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just by reading the title of this post you can rest assured that the s**t hit the fan on one of my SCCM Primary Sites today!&nbsp; One of our drives was almost full and it turned out that the SMSSIG$ folder was the culprit.</p>
<p>First you should ask yourself, how did this happen?&nbsp; How did I get here?&nbsp; Same as it ever was.&nbsp; Ahh….I digress.&nbsp; </p>
<p>Well, for starters you should have the No_SMS_on_drive.sms file in the root of all drives that you don’t want SCCM to use.&nbsp; For Distribution Points SCCM uses the drive with the most amount of free space.&nbsp; Once that drive fills up it will use the next drive with the most freespace.&nbsp; I am not sure that was my issue since I did have that file in the root of the drive that was filling up.&nbsp; But, I certainly could have put it there after the SMSSIG$ folder was created.</p>
<p>The next step is to ensure that the <strong>Site Settings &gt; Component Configuration &gt; Software Distribution &gt; Location of stored packages</strong> has the drive letter of the drive you want the SMSSIG$ folder on.&nbsp; In my case it was set to Z:\.&nbsp; I don’t have a Z: drive.&nbsp; At this point you are probably asking yourself “Hey Matthew, what kind of shop are you running there?”.&nbsp; I don’t know really!&nbsp; But, I do know how to fix the issue.</p>
<p>First I Googled “moving SMSSIG$ folder” and came across this article:&nbsp; <a title="http://www.myitforum.com/articles/1/view.asp?id=12833" href="http://www.myitforum.com/articles/1/view.asp?id=12833">http://www.myitforum.com/articles/1/view.asp?id=12833</a></p>
<p>You will notice that the article states that the SQL Update command has to be run for each packageID.&nbsp; Well, I had over 300, so like, um….yeah…that wasn’t happening.</p>
<p>Enter our best friend PowerShell.&nbsp; Here is the PowerShell script based on the article above.&nbsp; You will see that I am changing the drive from I$ to H$.&nbsp; Note:&nbsp; read the article above, don’t just execute the PowerShell code.&nbsp; The article states that this should be done on all of the parents of the site in question.</p>
<div style="margin:0;display:inline;float:none;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:2c5e1f93-c537-4f4f-84a3-38130f3dd2c5" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">Add-PSSnapin SqlServerCmdletSnapin100
$SQLCMD = Invoke-Sqlcmd "SELECT * FROM PkgStatus WHERE Sitecode = 'p01' and Type = 1 and location like '%i$%'"
foreach ($i in $SQLCMD)
	{
	$NewLocation = $i.location.replace("I$", "H$")
	$NewLocation = "'" + $NewLocation + "'"
	$i.ID = "'" + $i.ID + "'"
#	$i.ID
#	$NewLocation
	$NewSQLCMD = "UPDATE PkgStatus SET Location = $NewLocation WHERE Sitecode = 'P01' and Type = 1 and ID = " + $i.ID
	$NewSQLCMD
	Invoke-Sqlcmd $NewSQLCMD
	}
</pre>
</div>
<p>Then I figured I better move the SMSPKGSIG folder as well.&nbsp; Instructions here:&nbsp; <a title="http://www.myitforum.com/articles/1/view.asp?id=11981" href="http://www.myitforum.com/articles/1/view.asp?id=11981">http://www.myitforum.com/articles/1/view.asp?id=11981</a></p>
<p>I followed all of this up by creating a package and sending it to the DP in question and all is well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=115&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/04/18/moving-the-smssig-and-smspkgsig-folders-in-sccm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Patch Compliance Calendar</title>
		<link>http://emptygarden.info/2012/01/18/patch-compliance-calendar/</link>
		<comments>http://emptygarden.info/2012/01/18/patch-compliance-calendar/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 22:34:44 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=111</guid>
		<description><![CDATA[I received a request a few weeks ago to create a report that had one row for each server and then one column per month / year.&#160; In the column would be an asterisks if the server is compliant for &#8230; <a href="http://emptygarden.info/2012/01/18/patch-compliance-calendar/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=111&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I received a request a few weeks ago to create a report that had one row for each server and then one column per month / year.&nbsp; In the column would be an asterisks if the server is compliant for all that patches for that month (meaning, all that months patches are installed).</p>
<p>Well, after a ton of work I came up with something that meets their requirements.&nbsp; However, the tables that the report creates takes around 90 minutes to complete for around 750 servers!!&nbsp; So, I would recommend scheduling a job to run at night.</p>
<pre class="csharpcode"><span class="rem">-- *** Starting with [Your Company Name]_ServerPatchStatus ***</span>

<span class="rem">-- Create a temp table to hold the ResourceID and machinename</span>
<span class="kwrd">Create</span> <span class="kwrd">table</span> #ResourceID (ResourceID <span class="kwrd">int</span>, name <span class="kwrd">varchar</span>(64))
Insert <span class="kwrd">into</span> #ResourceID (ResourceID, name)
<span class="kwrd">select</span> resourceID, name <span class="kwrd">from</span> dbo.v_FullCollectionMembership <span class="kwrd">where</span> CollectionID = <span class="str">'[Enter the collectionID that you deploy patches to]'</span>
--<span class="kwrd">select</span> * <span class="kwrd">from</span> #ResourceID
--<span class="kwrd">drop</span> <span class="kwrd">table</span> #ResourceID

<span class="rem">-- Create a table to dump the results of the query to</span>
<span class="kwrd">drop</span> <span class="kwrd">table</span> [Your Company Name]_ServerPatchStatus
<span class="kwrd">create</span> <span class="kwrd">table</span> [Your Company Name]_ServerPatchStatus (
    MachineName <span class="kwrd">varchar</span>(255), 
    BulletinID <span class="kwrd">varchar</span>(64),
    ArticleID <span class="kwrd">varchar</span>(64),
    Title <span class="kwrd">varchar</span>(512),
    DatePosted datetime,
    DateRevised datetime,
    Targeted <span class="kwrd">varchar</span>(1),
    Installed <span class="kwrd">varchar</span>(1),
    IsRequired <span class="kwrd">varchar</span>(1),
    Notrequired <span class="kwrd">varchar</span>(1),
    LastBootUpTime datetime,
    SCCM_Last_Hardware_Inventory datetime,
    Last_WSUS_Scan datetime,
    WSUSscan_State <span class="kwrd">varchar</span>(255),
    ErrorStatusID <span class="kwrd">int</span>,
    ErrorCode <span class="kwrd">int</span>,
    HexErrorCode nvarchar(10),
    MaintenanceWindowName <span class="kwrd">varchar</span>(200), 
    Description <span class="kwrd">varchar</span>(512),
    StartTime datetime, 
    DurationMinutes <span class="kwrd">int</span>, 
    MaintenanceWindowEnabled <span class="kwrd">bit</span>)
    
Insert <span class="kwrd">into</span> [Your Company Name]_ServerPatchStatus (
    MachineName, 
    BulletinID,
    ArticleID,
    Title,
    DatePosted,
    DateRevised,
    Targeted,
    Installed,
    IsRequired,
    Notrequired,
    LastBootUpTime,
    SCCM_Last_Hardware_Inventory,
    Last_WSUS_Scan,
    WSUSscan_State,
    ErrorStatusID,
    ErrorCode,
    HexErrorCode,
    MaintenanceWindowName, 
    Description,
    StartTime, 
    DurationMinutes, 
    MaintenanceWindowEnabled)
    
<span class="kwrd">select</span> <span class="kwrd">distinct</span>
            #ResourceID.name <span class="kwrd">as</span> <span class="str">'MachineName'</span>,
            ui.BulletinID <span class="kwrd">as</span> BulletinID,
            ui.ArticleID <span class="kwrd">as</span> ArticleID,
            ui.Title <span class="kwrd">as</span> Title,      
            ui.dateposted,
            ui.daterevised,  
            Targeted=(<span class="kwrd">case</span> <span class="kwrd">when</span> ctm.ResourceID <span class="kwrd">is</span> <span class="kwrd">not</span> <span class="kwrd">null</span> <span class="kwrd">then</span> <span class="str">'*'</span> <span class="kwrd">else</span> <span class="str">''</span> <span class="kwrd">end</span>),
            Installed=(<span class="kwrd">case</span> <span class="kwrd">when</span> css.Status=3 <span class="kwrd">then</span> <span class="str">'*'</span> <span class="kwrd">else</span> <span class="str">''</span> <span class="kwrd">end</span>),
            IsRequired=(<span class="kwrd">case</span> <span class="kwrd">when</span> css.Status=2 <span class="kwrd">then</span> <span class="str">'*'</span> <span class="kwrd">else</span> <span class="str">''</span> <span class="kwrd">end</span>),
            NotRequired= (<span class="kwrd">case</span> <span class="kwrd">when</span> css.Status=1 <span class="kwrd">then</span> <span class="str">'*'</span> <span class="kwrd">else</span> <span class="str">''</span> <span class="kwrd">end</span>),
            os.LastBootUpTime0 <span class="kwrd">as</span> <span class="str">'LastBootUpTime'</span>,
            ws.LastHWScan <span class="kwrd">as</span> <span class="str">'SCCM_Last_Hardware_Inventory'</span>,
            Dateadd(<span class="kwrd">hour</span>,(datediff(<span class="kwrd">hour</span>,getutcdate(),getdate())),uss.lastscantime) <span class="kwrd">as</span> <span class="str">'Last_WSUS_Scan'</span>
            , scan.StateName <span class="str">'WSUSscan_State'</span>
            , scan.ErrorStatusID
            , scan.ErrorCode
            , scan.HexErrorCode,
            maint.MaintenanceWindowName <span class="kwrd">as</span> <span class="str">'MaintenanceWindowName'</span>, maint.Description, maint.StartTime, maint.DurationMinutes <span class="kwrd">as</span> <span class="str">'DurationMinutes'</span>, maint.Enabled <span class="kwrd">as</span> <span class="str">'CEPSWEnabled'</span>
<span class="kwrd">from</span> v_Update_ComplianceStatusall css
<span class="kwrd">join</span> #ResourceID <span class="kwrd">on</span> css.ResourceID = #ResourceID.ResourceID
<span class="kwrd">join</span> v_UpdateInfo ui <span class="kwrd">on</span> ui.CI_ID=css.CI_ID
<span class="kwrd">join</span> v_CIRelation cir <span class="kwrd">on</span> cir.ToCIID = ui.CI_ID
<span class="kwrd">join</span> v_CICategories_All catall <span class="kwrd">on</span> catall.CI_ID=ui.CI_ID 
<span class="kwrd">join</span> v_CategoryInfo catinfo <span class="kwrd">on</span> catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID <span class="kwrd">and</span> catinfo.CategoryTypeName=<span class="str">'Company'</span> 
<span class="kwrd">join</span> v_CICategories_All catall2 <span class="kwrd">on</span> catall2.CI_ID=ui.CI_ID 
<span class="kwrd">join</span> v_CategoryInfo catinfo2 <span class="kwrd">on</span> catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID <span class="kwrd">and</span> catinfo2.CategoryTypeName=<span class="str">'UpdateClassification'</span> 
<span class="kwrd">left</span> <span class="kwrd">join</span> v_CITargetedMachines ctm <span class="kwrd">on</span> ctm.CI_ID=css.CI_ID <span class="kwrd">and</span> ctm.ResourceID = #ResourceID.ResourceID
<span class="kwrd">left</span> <span class="kwrd">join</span> (
                        <span class="kwrd">select</span> atc.CI_ID, Deadline=<span class="kwrd">min</span>(a.EnforcementDeadline) <span class="kwrd">from</span> v_CIAssignment a
                        <span class="kwrd">join</span> v_CIAssignmentToCI atc <span class="kwrd">on</span> atc.AssignmentID=a.AssignmentID
                        <span class="kwrd">group</span> <span class="kwrd">by</span> atc.CI_ID) cdl   <span class="kwrd">on</span> cdl.CI_ID=css.CI_ID
<span class="kwrd">left</span> <span class="kwrd">join</span> (
            <span class="kwrd">select</span> fcm.resourceid, sw.Name <span class="kwrd">as</span> <span class="str">'MaintenanceWindowName'</span>, sw.Description, sw.StartTime, sw.Duration <span class="kwrd">as</span> <span class="str">'DurationMinutes'</span>, sw.IsEnabled <span class="kwrd">as</span> <span class="str">'Enabled'</span>,<span class="kwrd">case</span> <span class="kwrd">when</span> sw.RecurrenceType = 1 <span class="kwrd">then</span> <span class="str">'No Recurrence'</span>
            <span class="kwrd">when</span> sw.RecurrenceType = 2 <span class="kwrd">then</span> <span class="str">'Daily'</span>
            <span class="kwrd">when</span> sw.RecurrenceType = 3 <span class="kwrd">then</span> <span class="str">'Weekly'</span>
            <span class="kwrd">when</span> sw.RecurrenceType = 4 <span class="kwrd">then</span> <span class="str">'Monthly'</span>
            <span class="kwrd">else</span> <span class="str">'Unkwnon'</span> <span class="kwrd">end</span> <span class="kwrd">as</span> RecurrenceType, <span class="kwrd">case</span> <span class="kwrd">when</span> sw.ServiceWindowType=5 <span class="kwrd">then</span> <span class="str">'*'</span> <span class="kwrd">else</span> <span class="str">' '</span> <span class="kwrd">end</span> <span class="kwrd">as</span> <span class="str">'OSDServiceWindow'</span>
            , col.name <span class="kwrd">as</span> <span class="str">'CollectionName'</span>
            , col.CollectionID
            <span class="kwrd">from</span> v_ServiceWindow sw
            <span class="kwrd">join</span> v_FullCollectionMembership fcm <span class="kwrd">on</span> sw.CollectionID = fcm.CollectionID
            <span class="kwrd">join</span> v_Collection col
            <span class="kwrd">on</span> sw.collectionid = col.collectionid
            <span class="kwrd">where</span> sw.Name &lt;&gt; <span class="str">'NO RUN'</span>
            ) Maint <span class="kwrd">on</span> maint.ResourceID = css.ResourceID
<span class="kwrd">left</span> <span class="kwrd">join</span>     v_GS_WORKSTATION_STATUS ws <span class="kwrd">on</span> css.ResourceID = ws.ResourceID
<span class="kwrd">left</span> <span class="kwrd">join</span>     v_UpdateScanStatus uss <span class="kwrd">on</span> css.ResourceID = uss.ResourceID
<span class="kwrd">left</span> <span class="kwrd">join</span>   v_GS_Operating_System os <span class="kwrd">on</span> css.ResourceID = os.resourceid
<span class="kwrd">left</span> <span class="kwrd">join</span>
(
<span class="kwrd">select</span> uss.ResourceID, SN.StateName, uss.LastStatusMessageID&amp;0x0000FFFF <span class="kwrd">as</span> ErrorStatusID,
    isnull(uss.LastErrorCode,0) <span class="kwrd">as</span> ErrorCode,
    dbo.fnConvertBinaryToHexString(<span class="kwrd">convert</span>(VARBINARY(8), isnull(uss.LastErrorCode,0))) <span class="kwrd">as</span> HexErrorCode
 <span class="kwrd">from</span> v_UpdateScanStatus uss
    <span class="kwrd">join</span> v_R_System rsys <span class="kwrd">on</span> rsys.ResourceID = uss.ResourceID <span class="kwrd">and</span> isnull(rsys.Obsolete0,0)&lt;&gt;1
    <span class="kwrd">join</span> v_SoftwareUpdateSource sus <span class="kwrd">on</span> uss.UpdateSource_ID = sus.UpdateSource_ID 
    <span class="kwrd">join</span> v_RA_System_SMSAssignedSites sass <span class="kwrd">on</span> uss.ResourceID = sass.ResourceID
    <span class="kwrd">join</span> v_StateNames sn <span class="kwrd">on</span> sn.TopicType = 501 <span class="kwrd">and</span> 
        sn.StateID = (<span class="kwrd">case</span> <span class="kwrd">when</span> (isnull(uss.LastScanState, 0)=0 <span class="kwrd">and</span> <span class="kwrd">Left</span>(isnull(rsys.Client_Version0, <span class="str">'4.0'</span>), 1)&lt;<span class="str">'4'</span>) <span class="kwrd">then</span> 7 <span class="kwrd">else</span> isnull(uss.LastScanState, 0) <span class="kwrd">end</span>)
<span class="kwrd">where</span> 1= 1
    <span class="kwrd">and</span> (sus.UpdateSource_UniqueID = <span class="str">'{BE893E98-BD57-4E80-93F6-5D38B61C6069}'</span>)
) scan
<span class="kwrd">on</span> css.ResourceID = scan.ResourceID 
<span class="kwrd">where</span>  css.ResourceID = #ResourceID.ResourceID
<span class="kwrd">and</span> (css.Status=2 <span class="kwrd">or</span> css.Status=3 <span class="kwrd">or</span> css.Status=1)
<span class="kwrd">and</span> cir.FromCIID <span class="kwrd">in</span> 
(
<span class="kwrd">select</span> CI_ID
<span class="kwrd">from</span> v_AuthListInfo <span class="kwrd">where</span> Title <span class="kwrd">like</span> <span class="str">'%[enter the name of the update list(s) that you are inquiring about]%'</span>
)
<span class="kwrd">and</span> cir.RelationType=1

<span class="kwrd">drop</span> <span class="kwrd">table</span> #ResourceID

<span class="rem">-- *** Done with [Your Company Name]_ServerPatchStatus ***</span>

<span class="rem">-- *** Starting [Your Company Name]_ServerPatchComplianceCalender ***</span>

<span class="rem">-- Create a tempory table to hold the distinct months from the [Your Company Name]_ServerPatchStatus table</span>
<span class="kwrd">Create</span> <span class="kwrd">table</span> #<span class="kwrd">Month</span> (ID <span class="kwrd">int</span> <span class="kwrd">identity</span>(1,1), <span class="kwrd">Month</span> <span class="kwrd">int</span>)
Insert <span class="kwrd">into</span> #<span class="kwrd">Month</span> (<span class="kwrd">Month</span>)
<span class="kwrd">select</span> <span class="kwrd">distinct</span> datepart(<span class="kwrd">month</span>,DatePosted)
<span class="kwrd">from</span> [Your Company Name]_ServerPatchStatus
<span class="kwrd">order</span> <span class="kwrd">by</span> datepart(<span class="kwrd">month</span>,DatePosted)
<span class="rem">-- Select * from #Month</span>
<span class="rem">-- drop table #Month</span>

<span class="rem">-- Create a tempory table to hold the distinct years from the [Your Company Name]_ServerPatchStatus table</span>
<span class="kwrd">Create</span> <span class="kwrd">table</span> #<span class="kwrd">Year</span> (ID <span class="kwrd">int</span> <span class="kwrd">identity</span>(1,1), <span class="kwrd">Year</span> <span class="kwrd">int</span>)
Insert <span class="kwrd">into</span> #<span class="kwrd">Year</span> (<span class="kwrd">Year</span>)
<span class="kwrd">select</span> <span class="kwrd">distinct</span> datepart(<span class="kwrd">year</span>,DatePosted)
<span class="kwrd">from</span> [Your Company Name]_ServerPatchStatus
<span class="kwrd">order</span> <span class="kwrd">by</span> datepart(<span class="kwrd">year</span>,DatePosted)
<span class="rem">-- Select * from #Year</span>
<span class="rem">-- drop table #Year</span>

<span class="kwrd">drop</span> <span class="kwrd">table</span> [Your Company Name]_ServerPatchComplianceCalender  <span class="rem">--  This is the calender table that needs to be recreated each time this job runs</span>
<span class="kwrd">create</span> <span class="kwrd">table</span> [Your Company Name]_ServerPatchComplianceCalender (Machinename <span class="kwrd">varchar</span>(255), Last_WSUS_Scan datetime, WSUSscan_State <span class="kwrd">varchar</span>(255))
<span class="rem">-- select * from [Your Company Name]_ServerPatchComplianceCalender</span>
<span class="rem">-- drop table [Your Company Name]_ServerPatchComplianceCalender</span>

<span class="rem">-- Create a tempory table to hold the distinct machines from the [Your Company Name]_ServerPatchStatus table</span>
<span class="kwrd">Create</span> <span class="kwrd">table</span> #Machines (ID <span class="kwrd">int</span> <span class="kwrd">identity</span>(1,1), MachineName <span class="kwrd">varchar</span>(255), Last_WSUS_Scan datetime, WSUSscan_State <span class="kwrd">varchar</span>(255))
Insert <span class="kwrd">into</span> #Machines (MachineName, Last_WSUS_Scan, WSUSscan_State)
<span class="kwrd">select</span> <span class="kwrd">distinct</span> machinename, Last_WSUS_Scan, WSUSscan_State
<span class="kwrd">from</span> [Your Company Name]_ServerPatchStatus
<span class="kwrd">order</span> <span class="kwrd">by</span> machinename
<span class="rem">-- select * from #Machines</span>
<span class="rem">-- drop table #Machines </span>

<span class="rem">-- Create a variable to hold the minimum month.  This is used so that the While loop knows when to end.  Note, the table is in reverse chronological order</span>
<span class="kwrd">DECLARE</span> @MinMonth <span class="kwrd">int</span>
<span class="kwrd">SET</span> @MinMonth = (<span class="kwrd">Select</span> <span class="kwrd">MIN</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Month</span>)
<span class="rem">-- Select @MinMonth</span>

<span class="rem">-- Create a variable to iterate through the months</span>
<span class="kwrd">DECLARE</span> @IterMonth <span class="kwrd">int</span>
<span class="kwrd">SET</span> @IterMonth = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Month</span>)
<span class="rem">-- Select @IterMonth</span>

<span class="rem">-- Create a variable to hold the maximum year.  This is used so that the While loop knows when to end.  Note, the table is in reverse chronological order</span>
<span class="kwrd">DECLARE</span> @MinYear <span class="kwrd">int</span>
<span class="kwrd">SET</span> @MinYear = (<span class="kwrd">Select</span> <span class="kwrd">MIN</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Year</span>)
<span class="rem">-- Select @MinYear</span>

<span class="rem">-- Create a variable to iterate through the years</span>
<span class="kwrd">DECLARE</span> @IterYear <span class="kwrd">int</span>
<span class="kwrd">SET</span> @IterYear = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Year</span>)
<span class="rem">-- Select @IterYear</span>

<span class="rem">-- Create a variable to hold the maximum machine count.  This is used so that the While loop knows when to end</span>
<span class="kwrd">DECLARE</span> @MaxMachines <span class="kwrd">int</span>
<span class="kwrd">SET</span> @MaxMachines = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #Machines)
<span class="rem">-- select @MaxRownum</span>

<span class="rem">-- Create a variable to iterate through the months</span>
<span class="kwrd">DECLARE</span> @IterMachines <span class="kwrd">int</span>
<span class="kwrd">SET</span> @IterMachines = (<span class="kwrd">SELECT</span> <span class="kwrd">MIN</span>(ID) <span class="kwrd">FROM</span> #Machines)
<span class="rem">-- select @IterMachines</span>

<span class="rem">-- Build the columns of the table</span>
<span class="kwrd">WHILE</span> @IterYear &gt;= @MinYear
<span class="kwrd">BEGIN</span>
    <span class="kwrd">DECLARE</span> @<span class="kwrd">Year</span> <span class="kwrd">int</span>
    <span class="kwrd">set</span> @<span class="kwrd">Year</span> = (<span class="kwrd">Select</span> <span class="kwrd">YEAR</span> <span class="kwrd">from</span> #<span class="kwrd">Year</span> <span class="kwrd">where</span> ID = @IterYear)
    <span class="rem">-- Start a new loop with one year and one month at a time</span>
    <span class="kwrd">WHILE</span> @IterMonth &gt;= @MinMonth
    <span class="kwrd">BEGIN</span>
        <span class="kwrd">DECLARE</span> @<span class="kwrd">Month</span> <span class="kwrd">int</span>
        <span class="kwrd">Set</span> @<span class="kwrd">Month</span> = (<span class="kwrd">Select</span> <span class="kwrd">Month</span> <span class="kwrd">from</span> #<span class="kwrd">Month</span> <span class="kwrd">where</span> ID = @IterMonth)
        <span class="kwrd">DECLARE</span> @MonthYear <span class="kwrd">varchar</span>(20)
        <span class="kwrd">Set</span> @MonthYear = <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@<span class="kwrd">Month</span>) + <span class="str">'_'</span> + <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@<span class="kwrd">Year</span>)
        <span class="kwrd">SET</span> @MonthYear = <span class="str">'['</span> + @MonthYear + <span class="str">']'</span>
        <span class="kwrd">DECLARE</span> @<span class="kwrd">SQL</span> <span class="kwrd">VARCHAR</span>(<span class="kwrd">MAX</span>)
        <span class="rem">-- Build the [Your Company Name]_ServerPatchComplianceCalender by adding the current month and year as a column name</span>
        <span class="kwrd">IF</span> @<span class="kwrd">Year</span> &lt; DATEPART(<span class="kwrd">YEAR</span>,GETDATE()) <span class="kwrd">or</span> (@<span class="kwrd">Year</span> = DATEPART(<span class="kwrd">year</span>,Getdate()) <span class="kwrd">and</span> @<span class="kwrd">Month</span> = DATEPART(<span class="kwrd">month</span>,Getdate()))
            <span class="kwrd">SET</span> @<span class="kwrd">SQL</span> = <span class="str">'ALTER TABLE [Your Company Name]_ServerPatchComplianceCalender ADD '</span> + @MonthYear + <span class="str">' Varchar'</span>
            <span class="rem">-- Select @SQL</span>
            <span class="kwrd">EXEC</span>(@<span class="kwrd">SQL</span>)
        <span class="kwrd">Set</span> @IterMonth = @IterMonth - 1
        --<span class="kwrd">select</span> <span class="str">'This is IterMonth - '</span> + <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@IterMonth)
    <span class="kwrd">end</span>
    --<span class="kwrd">select</span> <span class="str">'This is IterYear - '</span> + <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@IterYear)
    <span class="kwrd">SET</span> @IterMonth = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Month</span>)
    <span class="kwrd">Set</span> @IterYear = @IterYear - 1
<span class="kwrd">end</span>

<span class="kwrd">SET</span> @IterMonth = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Month</span>)
<span class="kwrd">SET</span> @IterYear = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Year</span>)
<span class="kwrd">SET</span> @<span class="kwrd">SQL</span> = <span class="str">''</span>

<span class="rem">-- Start the loop with one machine</span>
<span class="kwrd">WHILE</span> @IterMachines &lt;= @MaxMachines
<span class="kwrd">BEGIN</span>
    <span class="kwrd">DECLARE</span> @MachineName <span class="kwrd">varchar</span>(255)
    <span class="kwrd">set</span> @MachineName = (<span class="kwrd">SELECT</span> machinename <span class="kwrd">FROM</span> #Machines <span class="kwrd">WHERE</span> ID = @IterMachines)
    --<span class="kwrd">select</span> @MachineName
    <span class="kwrd">DECLARE</span> @Last_WSUS_Scan datetime
    <span class="kwrd">set</span> @Last_WSUS_Scan = (<span class="kwrd">SELECT</span> Last_WSUS_Scan <span class="kwrd">from</span> #Machines <span class="kwrd">where</span> ID = @IterMachines)
    --<span class="kwrd">select</span> @Last_WSUS_Scan
    <span class="kwrd">DECLARE</span> @WSUSscan_State <span class="kwrd">varchar</span>(255)
    <span class="kwrd">set</span> @WSUSscan_State = (<span class="kwrd">SELECT</span> WSUSscan_State <span class="kwrd">from</span> #Machines <span class="kwrd">where</span> ID = @IterMachines)
    --<span class="kwrd">select</span> @WSUSscan_State
    insert <span class="kwrd">into</span> [Your Company Name]_ServerPatchComplianceCalender (Machinename, Last_WSUS_Scan, WSUSscan_State)
    <span class="kwrd">Values</span> (@MachineName, @Last_WSUS_Scan, @WSUSscan_State)
    <span class="rem">-- Start a new loop with the one machine and one year at a time</span>
    <span class="kwrd">WHILE</span> @IterYear &gt;= @MinYear
    <span class="kwrd">BEGIN</span>
        <span class="kwrd">set</span> @<span class="kwrd">Year</span> = (<span class="kwrd">Select</span> <span class="kwrd">YEAR</span> <span class="kwrd">from</span> #<span class="kwrd">Year</span> <span class="kwrd">where</span> ID = @IterYear)
        <span class="rem">-- Start a new loop with the one machine,one year and one month at a time</span>
        <span class="kwrd">WHILE</span> @IterMonth &gt;= @MinMonth
        <span class="kwrd">BEGIN</span>
            <span class="kwrd">Set</span> @<span class="kwrd">Month</span> = (<span class="kwrd">Select</span> <span class="kwrd">Month</span> <span class="kwrd">from</span> #<span class="kwrd">Month</span> <span class="kwrd">where</span> ID = @IterMonth)
            <span class="kwrd">Set</span> @MonthYear = <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@<span class="kwrd">Month</span>) + <span class="str">'_'</span> + <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@<span class="kwrd">Year</span>)
            <span class="kwrd">SET</span> @MonthYear = <span class="str">'['</span> + @MonthYear + <span class="str">']'</span>
            --<span class="kwrd">Select</span> @MonthYear 
            <span class="rem">-- If the machinename has at least one required patch for the given month and year then the column in the table will remain NULL</span>
            <span class="kwrd">IF</span> @<span class="kwrd">Year</span> &lt; DATEPART(<span class="kwrd">YEAR</span>,GETDATE()) <span class="kwrd">or</span> (@<span class="kwrd">Year</span> = DATEPART(<span class="kwrd">year</span>,Getdate()) <span class="kwrd">and</span> @<span class="kwrd">Month</span> = DATEPART(<span class="kwrd">month</span>,Getdate()))
                --<span class="kwrd">SET</span> @<span class="kwrd">SQL</span> = <span class="str">'update [Your Company Name]_ServerPatchComplianceCalender set '</span> + @MonthYear + <span class="str">' = '</span><span class="str">'*'</span><span class="str">' where Machinename = '</span><span class="str">''</span> 
                <span class="rem">--    + @MachineName + ''' and (' + cast(@year as varchar(4)) + ' &lt; datepart(year,getdate()) OR ( ' + cast(@month as varchar(2)) + ' = datepart(month,getdate()) and ' + cast(@year as varchar(4)) + ' = datepart(year,getdate()))) and Machinename not in (select machinename from [Your Company Name]_ServerPatchStatus where datepart(month,DatePosted) = ' </span>
                <span class="rem">--    + CAST(@Month as varchar(2)) + ' and datepart(year,dateposted)= ' + CAST(@Year as varchar(4)) + ' and isrequired = ''*''    and machinename = ''' + @MachineName + ''' )'</span>
                <span class="kwrd">SET</span> @<span class="kwrd">SQL</span> = <span class="str">'update [Your Company Name]_ServerPatchComplianceCalender set '</span> + @MonthYear + <span class="str">' = '</span><span class="str">'*'</span><span class="str">' where Machinename = '</span><span class="str">''</span> 
                    + @MachineName + <span class="str">''</span><span class="str">' and Machinename not in (select machinename from [Your Company Name]_ServerPatchStatus where datepart(month,DatePosted) = '</span> 
                    + <span class="kwrd">CAST</span>(@<span class="kwrd">Month</span> <span class="kwrd">as</span> <span class="kwrd">varchar</span>(2)) + <span class="str">' and datepart(year,dateposted)= '</span> + <span class="kwrd">CAST</span>(@<span class="kwrd">Year</span> <span class="kwrd">as</span> <span class="kwrd">varchar</span>(4)) + <span class="str">' and isrequired = '</span><span class="str">'*'</span><span class="str">'    and machinename = '</span><span class="str">''</span> + @MachineName + <span class="str">''</span><span class="str">' )'</span>    
        <span class="rem">-- Select @SQL</span>
                <span class="kwrd">EXEC</span>(@<span class="kwrd">SQL</span>)
            <span class="kwrd">Set</span> @IterMonth = @IterMonth - 1
            --<span class="kwrd">select</span> <span class="str">'This is IterMonth - '</span> + <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@IterMonth)
        <span class="kwrd">end</span>
        --<span class="kwrd">select</span> <span class="str">'This is IterYear - '</span> + <span class="kwrd">convert</span>(<span class="kwrd">varchar</span>,@IterYear)
        <span class="kwrd">SET</span> @IterMonth = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Month</span>)
        <span class="kwrd">Set</span> @IterYear = @IterYear - 1
    <span class="kwrd">end</span>
    <span class="kwrd">SET</span> @IterYear = (<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(ID) <span class="kwrd">FROM</span> #<span class="kwrd">Year</span>)
    <span class="kwrd">SET</span> @IterMachines = @IterMachines + 1
<span class="kwrd">END</span>

<span class="kwrd">drop</span> <span class="kwrd">table</span> #<span class="kwrd">Year</span>
<span class="kwrd">drop</span> <span class="kwrd">table</span> #<span class="kwrd">Month</span>
<span class="kwrd">drop</span> <span class="kwrd">table</span> #Machines

-- *** done <span class="kwrd">with</span> [Your Company Name]_ServerPatchComplianceCalender ***</pre>
<p>.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, &#8220;Courier New&#8221;, courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt<br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=111&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/01/18/patch-compliance-calendar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
		<item>
		<title>Software Update Reports</title>
		<link>http://emptygarden.info/2012/01/18/software-update-reports/</link>
		<comments>http://emptygarden.info/2012/01/18/software-update-reports/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 15:45:15 +0000</pubDate>
		<dc:creator>mteegarden</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mteegarden.wordpress.com/?p=107</guid>
		<description><![CDATA[Do you ever use the Software Updates reports that are built into SCCM?&#160; Have you ever wanted a report that details information about patch compliance on a particular collection of machines?&#160; List Of All Updates This report will list the &#8230; <a href="http://emptygarden.info/2012/01/18/software-update-reports/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=107&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Do you ever use the Software Updates reports that are built into SCCM?&nbsp; Have you ever wanted a report that details information about patch compliance on a particular collection of machines?&nbsp; </p>
<p><strong>List Of All Updates</strong></p>
<p>This report will list the following information:</p>
<ul>
<ul>
<li>Bulletin ID – example MS12-006
<li>Article ID – example 2638806
<li>Date Posted
<li>Date Revised
<li>Title
<li>Infromation URL
<li>Expired – yes or no
<li>Superseded – yes or no
<li>IsDeployed – yes or no</li>
</ul>
</ul>
<p>The report will have five prompts</p>
<ul>
<ul>
<li>Enter a month – example 10 for October or % for ALL
<li>Enter a year – example 2012 or % for ALL
<li>Enter an ArticleID – example 2638806 or % for ALL
<li>Enter an Update Title – Example %Windows 7% for all Windows 7 related patches
<li>Enter a BulletinID – Example MS12-006 or % for ALL</li>
</ul>
</ul>
<p>This report does not link to any other reports</p>
<p>Here is the report.&nbsp; You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7b080058-5b73-4b34-8770-e6992158b4fe" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Tuesday, January 17, 2012 created
//
//		File Name: List of all updates.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report lists the updates that were deployed for a given month and year.";
	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "* List of all updates *";
	NumPrompts = 5;
	RefreshInterval = 0;
	ReportGUID = "{11EA627B-6499-4C60-9D4F-C980E30B630F}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter a month";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n   select distinct DATEPART(month,ui.DatePosted) as Month
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   order by DATEPART(month,ui.DatePosted)
\n else
\n   select distinct DATEPART(month,ui.DatePosted) as Month from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   where DATEPART(month,ui.DatePosted) like @__filterwildcard
\n   order by DATEPART(month,ui.DatePosted)
\nend";
	VariableName = "Month";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter a year";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select distinct DATEPART(year,ui.DatePosted) as Year from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   order by DATEPART(year,ui.DatePosted)
\n else
\n  select distinct DATEPART(year,ui.DatePosted) as Year from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   where DATEPART(year,ui.DatePosted) like @__filterwildcard
\n  order by DATEPART(year,ui.DatePosted)
\nend";
	VariableName = "Year";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter an ArticleID or % for all.  Example:  987654";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n   select distinct ui.articleID
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   order by ui.articleID
\n else
\n   select distinct ui.articleID
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   where ui.articleID like @__filterwildcard
\n   order by ui.articleID
\nend";
	VariableName = "articleID";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter an update title or % for all.  Example:  %microsoft%";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n   select distinct ui.title
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   order by ui.title
\n else
\n   select distinct ui.title
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   where ui.title like @__filterwildcard
\n   order by ui.title
\nend";
	VariableName = "title";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter a BulletinID or % for all.  Example:  MSxx-xxx";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n   select distinct ui.BulletinID
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   order by ui.BulletinID
\n else
\n   select distinct ui.BulletinID
\n   from v_CIRelation cir 
\n   join  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\n   where ui.BulletinID like @__filterwildcard
\n   order by ui.BulletinID
\nend";
	VariableName = "BulletinID";
}};
	SecurityKey = "";
	SQLQuery = "select ui.BulletinID, ui.ArticleID, ui.DatePosted, ui.DateRevised, ui.title, ui.infoURL,
\n\tExpired = case when ui.Isexpired = 0 then 'NO' else 'YES' end,
\n\tSuperseded = case when ui.isSuperseded = 0 then 'NO' else 'YES' end,
\n\tIsDeployed = case when ui.IsDeployed = 0 then 'NO' else 'YES' end
\nfrom v_UpdateInfo ui
\nwhere  (datepart(month, ui.DatePosted) like @Month and datepart(year,ui.DatePosted) like @Year
\nor
\ndatepart(month, ui.DateRevised) like @Month and datepart(year,ui.DateRevised) like @Year )
\nand ui.articleID like @articleID
\nand ui.title like @title
\nand ui.BulletinID like @BulletinID
\norder by ui.bulletinID desc, ui.articleID desc";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****
</pre>
</div>
<p><strong></strong>&nbsp;</p>
<p><strong>Overall Software Update Status</strong></p>
<p>This report will display the patch status for a particular collection of machines.</p>
<p>This report will list the following information</p>
<ul>
<li>CollectionID</li>
<li>Business Unit – the name of the collection</li>
<li>Venor</li>
<li>Article ID – example 2638806</li>
<li>Bulletin ID – example MS12-006</li>
<li>Date Posted</li>
<li>Date Revised</li>
<li>Title</li>
<li>Expired – yes or no</li>
<li>Superseded – yes or no</li>
<li>IsDeployed – yes or no</li>
<li>Approved – yes or no</li>
<li>Installed – quantity of the machines in the collection that have installed the patch</li>
<li>Required &#8211; quantity of the machines in the collection that require the patch</li>
<li>Not Required &#8211; quantity of the machines in the collection that do not require the patch</li>
<li>Unknown &#8211; quantity of the machines in the collection that have a software update status of unknown for the patch</li>
<li>Total – total number of machines in the collection</li>
<li>%Compliant</li>
<li>%Not Compliant</li>
<li>%Unknown</li>
<li>Update ID – this is used for links to other reports.</li>
</ul>
<p>The report will have two prompts</p>
<ul>
<li>Select a Business Unit by clicking on the values button or enter % for ALL</li>
<li>Enter YES for patches that are being pushed, NO for ALL</li>
</ul>
<p>This report will link to the “<strong>Specific Software Updates States</strong>” report</p>
<ul>
<li>UpdateID – Column 21</li>
<li>CollectionID – Column 1</li>
</ul>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:5287d2fb-2856-4591-93f3-294eb59d031f" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: Overall Software Update Status.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report displays all updates for a particular buisness unit and  the percentage of compliant machines.";
	DrillThroughColumns = {};


	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "Overall Software Update Status";
	NumPrompts = 2;
	RefreshInterval = 0;
	ReportGUID = "{F18FAD6D-0BDD-4697-82C8-D96F6FF39922}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Select a Buisness Unit by clicking the values button";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  where b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]' and a.name not like '%No Client%'
\n  order by a.Name
\n else
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  WHERE a.CollectionID like @__filterwildcard
\n  order by a.Name
\nend";
	VariableName = "CollectionID";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter YES for patches that are being pushed.  NO for all";
	SampleValueSQL = "create table #temp (Choice char(3))
\ninsert into #temp (choice)
\nselect 'yes'
\ninsert into #temp (choice)
\nselect 'no'
\n
\nselect choice from #temp
\n";
	VariableName = "IsPushed";
}};
	SecurityKey = "";
	SQLQuery = "if @ISpushed = 'yes'
\nselect distinct us.CollectionID,
\nus.CollectionName as 'Business Unit',
\ncatinfo.CategoryInstanceName as Vendor0,
\n\tui.ArticleID as ArticleID,
\n\tui.BulletinID as BulletinID,
\nui.DatePosted,
\n\tui.DateRevised,
\n\tui.Title as Title,
\n\tExpired = case when ui.Isexpired = 0 then 'NO' else 'YES' end,
\n\tSuperseded = case when ui.isSuperseded = 0 then 'NO' else 'YES' end,
\n\tIsDeployed = case when ui.IsDeployed = 0 then 'NO' else 'YES' end,
\n\tApproved = case when col.CollectionID is not null then 'YES' else 'NO' end,\t
\n\tus.NumPresent as Present,
\n\tus.NumMissing as Missing,
\n\tus.NumNotApplicable as NotApplicable, 
\n\tus.NumUnknown as Unknown,
\n\tus.NumTotal as Total,
\n\tPCompliant=case when NumTotal&lt;&gt;0 then CAST((NumPresent+NumNotApplicable)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
\n\tPNotCompliant=case when NumTotal&lt;&gt;0 then CAST((NumMissing)*100.0/NumTotal as numeric(5,2)) else 0.0 end, 
\n\tPUnknown=case when NumTotal&lt;&gt;0 then CAST((NumUnknown)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
\nUniqueUpdateID=ui.CI_UniqueID
\nfrom v_CIRelation cir 
\njoin  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\njoin (v_CICategories_All catall join v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company') 
\n\ton catall.CI_ID=ui.CI_ID
\n--left join v_CITargetedCollections col on col.CI_ID=ui.CI_ID and col.CollectionID='[enter the collectionID of the collection that you target software updates to]'
\n--join v_UpdateSummaryPerCollection us on us.CI_ID=ui.CI_ID and us.CollectionID='[enter the collectionID of the collection that you target software updates to]'
\nleft join v_CITargetedCollections col on col.CI_ID=ui.CI_ID and col.CollectionID in (
\n\tselect a.collectionID
\n\tfrom v_collection a
\n\tjoin v_CollectToSubCollect b
\n\ton a.collectionID = b.subcollectionid
\n\twhere b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]' )
\njoin v_UpdateSummaryPerCollection us on us.CI_ID=ui.CI_ID and us.CollectionID = @CollectionID
\n--where cir.FromCIID=@AuthListLocalID and cir.RelationType=1
\nwhere cir.FromCIID in 
\n(
\nselect CI_ID
\nfrom v_AuthListInfo where Title like '%[Enter the portion of the title of the update lists you want displayed. Example:  if you had update lists titled "Servers - 2010", "Servers 2011", etc you could just enter %Servers%]%'
\n)
\nand cir.RelationType=1
\nand IsDeployed = 1
\norder by bulletinID desc, articleID desc
\nelse
\nselect distinct us.CollectionID,
\nus.CollectionName as 'Business Unit',
\ncatinfo.CategoryInstanceName as Vendor0,
\n\tui.ArticleID as ArticleID,
\n\tui.BulletinID as BulletinID,
\nui.DatePosted,
\n\tui.DateRevised,
\n\tui.Title as Title,
\n\tExpired = case when ui.Isexpired = 0 then 'NO' else 'YES' end,
\n\tSuperseded = case when ui.isSuperseded = 0 then 'NO' else 'YES' end,
\n\tIsDeployed = case when ui.IsDeployed = 0 then 'NO' else 'YES' end,
\n\tApproved = case when col.CollectionID is not null then 'YES' else 'NO' end,\t
\n\tus.NumPresent as Present,
\n\tus.NumMissing as Missing,
\n\tus.NumNotApplicable as NotApplicable, 
\n\tus.NumUnknown as Unknown,
\n\tus.NumTotal as Total,
\n\tPCompliant=case when NumTotal&lt;&gt;0 then CAST((NumPresent+NumNotApplicable)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
\n\tPNotCompliant=case when NumTotal&lt;&gt;0 then CAST((NumMissing)*100.0/NumTotal as numeric(5,2)) else 0.0 end, 
\n\tPUnknown=case when NumTotal&lt;&gt;0 then CAST((NumUnknown)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
\nUniqueUpdateID=ui.CI_UniqueID
\nfrom v_CIRelation cir 
\njoin  v_UpdateInfo ui on cir.ToCIID = ui.CI_ID
\njoin (v_CICategories_All catall join v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company') 
\n\ton catall.CI_ID=ui.CI_ID
\n--left join v_CITargetedCollections col on col.CI_ID=ui.CI_ID and col.CollectionID='[enter the collectionID of the collection that you target software updates to]'
\n--join v_UpdateSummaryPerCollection us on us.CI_ID=ui.CI_ID and us.CollectionID='[enter the collectionID of the collection that you target software updates to]'
\nleft join v_CITargetedCollections col on col.CI_ID=ui.CI_ID and col.CollectionID in (
\n\tselect a.collectionID
\n\tfrom v_collection a
\n\tjoin v_CollectToSubCollect b
\n\ton a.collectionID = b.subcollectionid
\n\twhere b.parentcollectionID = '[enter the collectionID of the collection that you target software updates to]' )
\njoin v_UpdateSummaryPerCollection us on us.CI_ID=ui.CI_ID and us.CollectionID = @CollectionID
\n--where cir.FromCIID=@AuthListLocalID and cir.RelationType=1
\nwhere 1=1
\norder by bulletinID desc, articleID desc";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****</pre>
</div>
<p><strong></strong>&nbsp;</p>
<p><strong>Specific Software Updates States</strong></p>
<p>This report will show the various states of a particular update for a certain collection.</p>
<p>This report will list the following information:</p>
<ul>
<li>CollectionID</li>
<li>Business Unit – the name of the collection</li>
<li>State Name – Required, installed, unknown or not required</li>
<li>Count – The count of update states for the collection</li>
<li>%Total – percent of update states for the collection</li>
<li>UpdateID – this is used for linking to other reports</li>
</ul>
<p>The report will have the following prompts</p>
<ul>
<li>UpdateID – ie: MS12-006</li>
<li>CollectionID – The collection ID of a particular business unit</li>
</ul>
<p>The report will link to the “<strong>Computers in a specific compliance state for an update</strong>” report</p>
<ul>
<li>UpdateID – column 6</li>
<li>Status – column 3</li>
<li>CollectionID – column 1</li>
</ul>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:5319d3fd-ef88-4ae3-92f4-008f020cc361" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: Specific software updates states.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report returns the count and percentage of computers in each compliance state for the specified software update.";
	DrillThroughColumns = {};


	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "Specific software updates states";
	NumPrompts = 2;
	RefreshInterval = 0;
	ReportGUID = "{7197C921-F2D4-4D59-A838-56B9868EF503}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Update ID (Required)";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select distinct CI_UniqueID, ArticleID, BulletinID, Title from v_UpdateInfo
\n\twhere title not like '%server%'
\n\torder by BulletinID desc, ArticleID desc
\n else
\n  select distinct CI_UniqueID, ArticleID, BulletinID, Title from v_UpdateInfo
\n  WHERE (CI_UniqueID like @__filterwildcard
\n OR Title like @__filterwildcard
\n OR BulletinID like @__filterwildcard
\n OR ArticleID like @__filterwildcard)
\nand title not like '%server%'
\n  order by BulletinID desc, ArticleID desc
\nend";
	VariableName = "UpdateID";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter a collection ID";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  where b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]' and a.name not like '%No Client%'
\n  order by a.Name
\n else
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  WHERE a.CollectionID like @__filterwildcard
\n  order by a.Name
\nend";
	VariableName = "CollectionID";
}};
	SecurityKey = "";
	SQLQuery = "declare @Unknown as varchar (256)
\ndeclare @NotRequired as varchar (256)
\ndeclare @Missing as varchar (256)
\ndeclare @Installed as varchar (256)
\ndeclare @Total as int
\n
\nselect @Unknown = StateName from v_StateNames where TopicType=500 and StateID=0
\nselect @NotRequired = StateName from v_StateNames where TopicType=500 and StateID=1
\nselect @Missing = StateName from v_StateNames where TopicType=500 and StateID=2
\nselect @Installed = StateName from v_StateNames where TopicType=500 and StateID=3
\n
\nselect @Total = NumTotal 
\n\tfrom v_UpdateSummaryPerCollection us
\n\tjoin v_Collection col on col.CollectionID=us.CollectionID
\n\tjoin v_UpdateInfo ui on us.CI_ID=ui.CI_ID
\nwhere col.CollectionID = @CollectionID
\nand (@UpdateID='' or ui.CI_UniqueID = @UpdateID)
\n
\nselect\tui.ArticleID as ArticleID, 
\n\tui.BulletinID as BulletinID,
\n\tui.Title as Title
\nfrom v_UpdateInfo ui where ui.CI_UniqueID = @UpdateID
\n
\nselect @Total as NumberInCollection
\n
\nselect 
\n         col.CollectionID as CollectionID,
\n\t\t col.Name as 'Business Unit',
\n         Status=case a.SetVariable 
\n\t\t\twhen 1 then @Unknown 
\n\t        when 2 then @NotRequired 
\n\t        when 3 then @Missing 
\n\t        else @Installed
\n\t        end,
\n         NumberOfComputers=case a.SetVariable 
\n\t\t\twhen 1 then NumUnknown 
\n\t  \t\twhen 2 then NumNotApplicable 
\n\t\t\twhen 3 then NumMissing
\n\t\t\telse NumPresent
\n \t\t    end,
\n         PComputers=case a.SetVariable 
\n\t\t\twhen 1 then convert(numeric(5,2), (isnull(NumUnknown, 0)*100.0) / isnull(nullif(@Total, 0), 1))
\n\t  \t\twhen 2 then convert(numeric(5,2), (isnull(NumNotApplicable, 0)*100.0) / isnull(nullif(@Total, 0), 1))
\n\t\t\twhen 3 then convert(numeric(5,2), (isnull(NumMissing, 0)*100.0) / isnull(nullif(@Total, 0), 1))
\n\t\t\telse convert(numeric(5,2), (isnull(NumPresent, 0)*100.0) / isnull(nullif(@Total, 0), 1))
\n \t\t    end,\t\t  
\n          UniqueUpdateID= ui.CI_UniqueID
\nfrom (select SetVariable=3 union all 
\n          select SetVariable=4 union all 
\n          select SetVariable=1 union all
\n          select SetVariable=2 )as a 
\ncross join v_UpdateSummaryPerCollection us 
\njoin v_Collection col on col.CollectionID=us.CollectionID
\njoin v_UpdateInfo ui on us.CI_ID=ui.CI_ID
\nwhere col.CollectionID = @CollectionID
\nand (@UpdateID='' or ui.CI_UniqueID = @UpdateID)";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****</pre>
</div>
<p>&nbsp;</p>
<p><strong>Computers in a specific compliance state for an update</strong></p>
<p>This report lists the specific software update status for each machine in a collection</p>
<p>This report will list the following information:</p>
<ul>
<li>Computer Name</li>
<li>AD Site</li>
<li>Business Unit – The name of the collection</li>
<li>Article ID – example 2585542</li>
<li>Bulletin ID – MS12-006</li>
<li>Title</li>
<li>Update Status</li>
<li>SCCM Last Hardwar Inventory – date</li>
<li>Last WSUS Scan – date</li>
<li>WSUSscan_State</li>
<li>Error Status ID – If the WSUSscan_State is not “scan completed” then this column will display the ErrorID for troubleshooting</li>
<li>Error Code – If the WSUSscan_State is not “scan completed” then this column will display the ErrorCode for troubleshooting</li>
<li>HexErrorCode &#8211; If the WSUSscan_State is not “scan completed” then this column will display the HexCode for troubleshooting</li>
<li>Last Logged On User</li>
<li>Assigned Site – SCCM Assigned Site</li>
<li>Client Version – SCCM Client Version</li>
</ul>
<p>The report will have three prompts</p>
<ul>
<li>UpdateID – example MS12-006</li>
<li>State Name – Example “Update is installed” or “Update is Required”</li>
<li>CollectionID – The collection ID of a particular business unit</li>
</ul>
<p>The report will link to the “<strong>Compliance for a specific computer</strong>” report</p>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a15a80a8-c697-4050-9334-279a3ac60a30" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: Computers in a specific compliance state for an update.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report returns all computers in a collection that have a specific compliance state for a software update.";
	DrillThroughColumns = {};


	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "Computers in a specific compliance state for an update";
	NumPrompts = 3;
	RefreshInterval = 0;
	ReportGUID = "{C5616815-4C02-430A-B132-F69580667844}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Update ID (Required)";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select distinct CI_UniqueID as UniqueUpdateID, ArticleID, BulletinID, Title from v_UpdateInfo
\n  where title not like '%server%'
\n  order by BulletinID desc, ArticleID desc
\n else
\n  select distinct CI_UniqueID as UniqueUpdateID, ArticleID, BulletinID, Title from v_UpdateInfo
\n  WHERE (CI_UniqueID like @__filterwildcard
\n OR Title like @__filterwildcard
\n OR BulletinID like @__filterwildcard
\n OR ArticleID like @__filterwildcard)
\nand title not like '%server%'
\n  order by BulletinID desc, ArticleID desc
\nend";
	VariableName = "UpdateID";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "State Name (Required)";
	SampleValueSQL = "begin
\nif (@__filterwildcard = '')
\nselect StateName as State, StateID as StateID
\n\tfrom v_StateNames where TopicType=500
\nelse 
\nselect StateName as State, StateID as StateID
\n\tfrom v_StateNames where TopicType=500
\n\tand ((StateName like @__filterwildcard)
\n\tor (StateID like @__filterwildcard))
\nend";
	VariableName = "Status";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "CollectionID (required)";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  where (b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]') and a.name not like '%No Client%'
\n  order by a.Name
\n else
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  WHERE a.CollectionID like @__filterwildcard
\n  order by a.Name
\nend";
	VariableName = "CollectionID";
}};
	SecurityKey = "";
	SQLQuery = "declare @Unknown as varchar (256)
\ndeclare @NotRequired as varchar (256)
\ndeclare @Missing as varchar (256)
\ndeclare @Installed as varchar (256)
\n
\nselect @Unknown = StateName from v_StateNames where TopicType=500 and StateID=0
\nselect @NotRequired = StateName from v_StateNames where TopicType=500 and StateID=1
\nselect @Missing = StateName from v_StateNames where TopicType=500 and StateID=2
\nselect @Installed = StateName from v_StateNames where TopicType=500 and StateID=3
\n
\ndeclare @CIID int; select @CIID=CI_ID from v_UpdateInfo where CI_UniqueID=@UpdateID
\nselect 
\nm.Name0 as ComputerName0,
\nm.AD_Site_Name0 as 'AD Site',
\ncol.Name as 'Business Unit',
\nui.ArticleID as ArticleID, 
\nui.BulletinID as BulletinID,
\nui.Title as Title,
\n@Status as 'Update Status',
\n            ws.LastHWScan as 'SCCM Last Hardware Inventory',
\n            Dateadd(hour,(datediff(hour,getutcdate(),getdate())),uss.lastscantime) as 'Last WSUS Scan'
\n            , scan.StateName 'WSUSscan_State'
\n\t\t\t, scan.ErrorStatusID
\n\t\t\t, scan.ErrorCode
\n\t\t\t, scan.HexErrorCode,
\nm.User_Name0 as LastLoggedOnUser,
\nasite.SMS_Assigned_Sites0 as AssignedSite, 
\nm.Client_Version0 as ClientVersion,
\nDATEADD(ss,@__timezoneoffset,LastStatusCheckTime) as LastStateReceived, 
\nDATEADD(ss,@__timezoneoffset,LastStatusChangeTime) as LastStateChange,
\n''
\nfrom v_Update_ComplianceStatusAll ucs 
\njoin v_UpdateInfo ui on ucs.CI_ID=ui.CI_ID
\njoin v_ClientCollectionMembers cm on cm.ResourceID=ucs.ResourceID
\njoin v_collection col on col.collectionID = cm.collectionID
\njoin v_R_System m on m.ResourceType=5 and m.ResourceID=ucs.ResourceID and isnull(m.Obsolete0,0)&lt;&gt;1
\nleft join v_RA_System_SMSAssignedSites asite on m.ResourceID=asite.ResourceID
\nleft join \tv_GS_WORKSTATION_STATUS ws on cm.ResourceID = ws.ResourceID
\nleft join \tv_UpdateScanStatus uss on cm.ResourceID = uss.ResourceID
\nleft join
\n(
\nselect uss.ResourceID, SN.StateName, uss.LastStatusMessageID&amp;0x0000FFFF as ErrorStatusID,
\n\tisnull(uss.LastErrorCode,0) as ErrorCode,
\n\tdbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0))) as HexErrorCode
\n from v_UpdateScanStatus uss
\n\tjoin v_R_System rsys on rsys.ResourceID = uss.ResourceID and isnull(rsys.Obsolete0,0)&lt;&gt;1
\n\tjoin v_SoftwareUpdateSource sus on uss.UpdateSource_ID = sus.UpdateSource_ID 
\n\tjoin v_RA_System_SMSAssignedSites sass on uss.ResourceID = sass.ResourceID
\n\tjoin v_StateNames sn on sn.TopicType = 501 and 
\n\t\tsn.StateID = (case when (isnull(uss.LastScanState, 0)=0 and Left(isnull(rsys.Client_Version0, '4.0'), 1)&lt;'4') then 7 else isnull(uss.LastScanState, 0) end)
\nwhere 1= 1
\n\t--and (sass.SMS_Assigned_Sites0= 'P01')
\n\t--and (sn.StateName='Scan failed')
\n\tand (sus.UpdateSource_UniqueID = '{BE893E98-BD57-4E80-93F6-5D38B61C6069}')
\n) scan
\non cm.ResourceID = scan.ResourceID 
\nwhere ucs.CI_ID=@CIID
\nand cm.CollectionID  = @CollectionID
\nand ((@Status='')
\n\tor (@Status = @Unknown and ucs.Status=0) 
\n\tor (@Status = @NotRequired and ucs.Status=1)
\n\tor (@Status = @Missing and ucs.Status=2)
\n\tor (@Status = @Installed and ucs.Status=3))
\norder by m.Name0";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****</pre>
</div>
<p><strong>Compliance for a specific computer</strong></p>
<p>This report shows the patch status for a specific computer</p>
<p>This report will list the following information:</p>
<ul>
<li>MachineName</li>
<li>Vendor</li>
<li>Update Class – example:&nbsp; security update, service pack, etc</li>
<li>BulletinID – example MS12-006</li>
<li>ArticleID – example 2526086</li>
<li>Title</li>
<li>Date Posted</li>
<li>Date Revised</li>
<li>Approved – this means that the patch is in an Update List</li>
<li>Installed – an asterisk indicates that the patch is installed</li>
<li>Is Required – an asterisk indicates that the patch is required</li>
<li>PatchInstallDate</li>
<li>Last State Change – date</li>
<li>Deadline – This is the deadline you set in the Deployment Management</li>
<li>SCCM Last Hardware Inventory – Date</li>
<li>Last WSUS Scan – date</li>
<li>WSUSscan_State</li>
<li>Error Status ID – If the WSUSscan_State is not “scan completed” then this column will display the ErrorID for troubleshooting</li>
<li>Error Code – If the WSUSscan_State is not “scan completed” then this column will display the ErrorCode for troubleshooting</li>
<li>HexErrorCode &#8211; If the WSUSscan_State is not “scan completed” then this column will display the HexCode for troubleshooting</li>
<li>UpdateID</li>
<li>Information URL</li>
</ul>
<p>This report has one prompt</p>
<ul>
<li>Enter a MachineName</li>
</ul>
<p>This report does not have any links to other reports</p>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7a8ecb23-590d-4b86-bb52-e355e454e416" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: Compliance for a specific computer.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report returns the software update compliance data for a specific computer.";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "Compliance for a specific computer";
	NumPrompts = 1;
	RefreshInterval = 0;
	ReportGUID = "{DE76B7D3-29B5-493F-AE12-1DDC591163E2}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Computer Name (Required)";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select distinct Name0 from v_R_System WHERE isnull(Obsolete0,0)&lt;&gt;1 order by Name0
\n else
\n  select distinct Name0 from v_R_System
\n  WHERE Name0 like @__filterwildcard
\n and isnull(Obsolete0,0)&lt;&gt;1 order by Name0
\nend";
	VariableName = "MachineName";
}};
	SecurityKey = "";
	SQLQuery = "SET NOCOUNT ON
\n
\nCreate table #ResourceID (ResourceID int, name0 varchar(64))
\nInsert into #ResourceID (ResourceID, name0)
\nselect resourceID, name0 from v_R_System where ((Name0 like @MachineName) and (Active0 = 1) and Operating_System_Name_and0 not like '%server%')
\n--select * from #ResourceID
\n--drop table #ResourceID
\n
\n--select 'Total number of machines', count(ResourceID) from #ResourceID
\n
\nselect 
\n\t\t\t#ResourceID.name0 as 'Machine Name',
\n\t\t\tcatinfo.CategoryInstanceName as Vendor,
\n\t\t\tcatinfo2.CategoryInstanceName as UpdateClassification,
\n            ui.BulletinID as BulletinID,
\n            ui.ArticleID as ArticleID,
\n            ui.Title as Title,   
\n            ui.dateposted,
\n            ui.daterevised,             
\n            Targeted=(case when ctm.ResourceID is not null then '*' else '' end),
\n            Installed=(case when css.Status=3 then '*' else '' end),
\n            IsRequired=(case when css.Status=2 then '*' else '' end),
\n\t\t\tcss.LastStatusCheckTime as 'PatchInstallDate',
\n\t\t\tcss.LastStatusChangeTime as 'LastStateChange',
\n            Deadline=cdl.Deadline,
\n            ws.LastHWScan as 'SCCM Last Hardware Inventory',
\n            Dateadd(hour,(datediff(hour,getutcdate(),getdate())),uss.lastscantime) as 'Last WSUS Scan'
\n            , scan.StateName 'WSUSscan_State'
\n\t\t\t, scan.ErrorStatusID
\n\t\t\t, scan.ErrorCode
\n\t\t\t, scan.HexErrorCode,
\n            ui.CI_UniqueID as UniqueUpdateID,
\n\t\t\tui.InfoURL as InformationURL
\nfrom v_Update_ComplianceStatusall css
\njoin #ResourceID on css.ResourceID = #ResourceID.ResourceID
\njoin v_UpdateInfo ui on ui.CI_ID=css.CI_ID
\njoin v_CIRelation cir on cir.ToCIID = ui.CI_ID
\njoin v_CICategories_All catall on catall.CI_ID=ui.CI_ID 
\njoin v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company' 
\njoin v_CICategories_All catall2 on catall2.CI_ID=ui.CI_ID 
\njoin v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName='UpdateClassification' 
\n--left join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = @RscID
\nleft join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = #ResourceID.ResourceID
\nleft join (
\n                        select atc.CI_ID, Deadline=min(a.EnforcementDeadline) from v_CIAssignment a
\n                        join v_CIAssignmentToCI atc on atc.AssignmentID=a.AssignmentID
\n                        group by atc.CI_ID) cdl   on cdl.CI_ID=css.CI_ID
\n--where  css.ResourceID = @RscID 
\nleft join \tv_GS_WORKSTATION_STATUS ws on css.ResourceID = ws.ResourceID
\nleft join \tv_UpdateScanStatus uss on css.ResourceID = uss.ResourceID
\nleft join
\n(
\nselect uss.ResourceID, SN.StateName, uss.LastStatusMessageID&amp;0x0000FFFF as ErrorStatusID,
\n\tisnull(uss.LastErrorCode,0) as ErrorCode,
\n\tdbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0))) as HexErrorCode
\n from v_UpdateScanStatus uss
\n\tjoin v_R_System rsys on rsys.ResourceID = uss.ResourceID and isnull(rsys.Obsolete0,0)&lt;&gt;1
\n\tjoin v_SoftwareUpdateSource sus on uss.UpdateSource_ID = sus.UpdateSource_ID 
\n\tjoin v_RA_System_SMSAssignedSites sass on uss.ResourceID = sass.ResourceID
\n\tjoin v_StateNames sn on sn.TopicType = 501 and 
\n\t\tsn.StateID = (case when (isnull(uss.LastScanState, 0)=0 and Left(isnull(rsys.Client_Version0, '4.0'), 1)&lt;'4') then 7 else isnull(uss.LastScanState, 0) end)
\nwhere 1= 1
\n\t--and (sass.SMS_Assigned_Sites0= 'P01')
\n\t--and (sn.StateName='Scan failed')
\n\tand (sus.UpdateSource_UniqueID = '{BE893E98-BD57-4E80-93F6-5D38B61C6069}')
\n) scan
\non css.ResourceID = scan.ResourceID 
\nwhere  css.ResourceID = #ResourceID.ResourceID
\nand ((css.Status=2) or (css.Status=3))
\n--and (@Vendor = '' or catinfo.CategoryInstanceName = @Vendor)
\n--and (@UpdateClass = '' or catinfo2.CategoryInstanceName = @UpdateClass)
\nand cir.FromCIID in 
\n(
\nselect CI_ID
\nfrom v_AuthListInfo where Title like '[Enter the portion of the title of the update lists you want displayed. Example:  if you had update lists titled "Servers - 2010", "Servers 2011", etc you could just enter %Servers%]'
\n)
\nand cir.RelationType=1
\n--order by  ui.BulletinID desc
\norder by #ResourceID.name0, ui.BulletinID desc";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
};
// ***** End *****</pre>
</div>
<p>&nbsp;</p>
<p><strong>Specific software update status</strong></p>
<p>This report list the compliance percentage of a particular patch</p>
<p>This report will list the following information:</p>
<ul>
<li>Vendor</li>
<li>ArticleID – example:&nbsp; 2585542</li>
<li>BuletinID – example: MS12-006</li>
<li>Title</li>
<li>Installed – quantity of machines with the patch installed</li>
<li>Required – quantity of machines that require the patch</li>
<li>Not Required – quantity of machines that do no require the patch</li>
<li>Unknown – quantity of machines that have an status of “unknown” for the patch</li>
<li>Total – total quantity of the machines</li>
<li>%Compliant</li>
<li>%Not Compliant</li>
<li>%Unknown</li>
<li>CollectionID</li>
<li>Update ID</li>
</ul>
<p>This report will have one prompt</p>
<ul>
<li>Update Title, Bulletin ID or Article ID</li>
</ul>
<p>This report will link to the <strong>Specific Software Updates States </strong>report</p>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:5b49525f-d9f4-43dc-acab-ddb7803be875" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: Specific software update status.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report returns the patch percentage of machines for a particular update.";
	DrillThroughColumns = {};


	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "Specific software update status";
	NumPrompts = 1;
	RefreshInterval = 0;
	ReportGUID = "{0D228B49-56B8-4DA9-A0E2-27D64642B0E3}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Update Title, Bulletin ID or Article ID (Required)";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select distinct ArticleID, BulletinID, Title from v_UpdateInfo
\n  where title not like '%server%'
\n  order by BulletinID desc, ArticleID desc
\n else
\n  select distinct ArticleID, BulletinID, Title from v_UpdateInfo
\n  WHERE ((ArticleID like @__filterwildcard) or 
\n         (BulletinID like @__filterwildcard) or 
\n         (Title like @__filterwildcard))
\n\tand title not like '%server%'
\n  order by BulletinID desc, ArticleID desc
\nend";
	VariableName = "Update";
}};
	SecurityKey = "";
	SQLQuery = "set nocount on
\ndeclare @UpdInfo table (CI_ID int primary key, BulletinID varchar(64), ArticleID varchar(64), Title varchar(512), CI_UniqueID varchar(512))
\ninsert into @UpdInfo (CI_ID, BulletinID, ArticleID, Title, CI_UniqueID) 
\n    select CI_ID, BulletinID, ArticleID, Title, CI_UniqueID
\n    from v_UpdateInfo ui
\n    where (ui.ArticleID=@Update) 
\n    or (ui.BulletinID=@Update) 
\n    or (ui.Title=@Update) 
\n    or (ui.CI_UniqueID=@Update)
\n    and ui.title not like '%server%'
\n
\nselect  catinfo.CategoryInstanceName as Vendor0,
\n        ui.ArticleID as ArticleID, 
\n        ui.BulletinID as BulletinID,
\n        ui.Title as Title,
\n        NumPresent as Present,
\n        NumMissing as Missing,
\n        NumNotApplicable as NotApplicable,
\n        NumUnknown as Unknown,
\n        NumTotal as Total,
\n        PCompliant=convert(numeric(5,2), (isnull(NumPresent, 0)+isnull(NumNotApplicable, 0))*100.0 / isnull(nullif(NumTotal, 0), 1)),
\n        PNotCompliant=convert(numeric(5,2), (isnull(NumMissing, 0))*100.0 / isnull(nullif(NumTotal, 0), 1)),
\n        PUnknown=convert(numeric(5,2), (isnull(NumTotal - (isnull(NumPresent, 0)+isnull(NumMissing, 0)+isnull(NumNotApplicable, 0)), 0))*100.0 / isnull(nullif(NumTotal, 0), 1)),
\n        CollectionID as CollectionID,
\n        ui.CI_UniqueID as UniqueUpdateID 
\nfrom @UpdInfo ui
\njoin v_UpdateSummaryPerCollection uspc on ui.CI_ID = uspc.CI_ID and uspc.CollectionID in ('[Enter the collection ID of the collection that you target Software Updates to]')
\njoin v_CICategoryInfo_All catinfo on ui.CI_ID = catinfo.CI_ID and catinfo.CategoryTypeName = 'Company'
\norder by ui.ArticleID";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****</pre>
</div>
<p>&nbsp;</p>
<p><strong>Machines that are missing a patch over 30 days old</strong></p>
<p>This report lists all machines that require a patch that has been created or modified over 30 days ago</p>
<p>This report will list the following information</p>
<ul>
<li>MachineName</li>
<li>Vendor</li>
<li>Update Class</li>
<li>ArticleID – example: 2585542</li>
<li>BuletinID – example: MS12-006</li>
<li>Title</li>
<li>Date Posted</li>
<li>Date Revised</li>
<li>Expired – Yes or no</li>
<li>Superseded – yes or no</li>
<li>IsDeployed – yes or no</li>
<li>Is Required – an asterisk indicates that the patch is required</li>
<li>Deadline – this is the deadline for the Deployment Management</li>
<li>SCCM Last Hardwar Inventory – date</li>
<li>Last WSUS Scan – date</li>
<li>WSUSscan_State</li>
<li>Error Status ID – If the WSUSscan_State is not “scan completed” then this column will display the ErrorID for troubleshooting</li>
<li>Error Code – If the WSUSscan_State is not “scan completed” then this column will display the ErrorCode for troubleshooting</li>
<li>HexErrorCode &#8211; If the WSUSscan_State is not “scan completed” then this column will display the HexCode for troubleshooting</li>
<li>Update ID</li>
<li>Information URL</li>
</ul>
<p>This report will have two prompts</p>
<ul>
<li>Select a Business Unit by clicking on the values button or enter % for ALL</li>
<li>Enter YES for patches that are being pushed, NO for ALL</li>
</ul>
<p>This report will link to the “<strong>Compliance for a specific computer</strong>” report</p>
<ul>
<li>Machinename – column 1</li>
</ul>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:3d7a120e-6d91-45bd-839c-8e71bd59ea08" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: Machines that are missing a patch over 30 days old.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report lists all machines that require a patch that has been created or modified over 30 days ago.";
	DrillThroughColumns = {};


	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "Machines that are missing a patch over 30 days old";
	NumPrompts = 2;
	RefreshInterval = 0;
	ReportGUID = "{7AE2D12B-C0DE-4728-BFA7-58CDE4ADFE84}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Select a business unit or % for all";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  where b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]' and a.name not like '%No Client%'
\n  order by a.Name
\n else
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  WHERE a.CollectionID like @__filterwildcard
\n  order by a.Name
\nend";
	VariableName = "CollectionID";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter YES for pushed patches or NO for all patches";
	SampleValueSQL = "";
	VariableName = "IsPushed";
}};
	SecurityKey = "";
	SQLQuery = "if @ISpushed = 'yes'
\nselect distinct
\n\t\t\tRsys.name0 as 'Machine Name',
\n\t\t\tcatinfo.CategoryInstanceName as Vendor,
\n\t\t\tcatinfo2.CategoryInstanceName as UpdateClassification,
\n            ui.BulletinID as BulletinID,
\n            ui.ArticleID as ArticleID,
\n            ui.Title as Title,    
\n            ui.DatePosted,
\n            ui.DateRevised,        
\n            --Targeted=(case when ctm.ResourceID is not null then '*' else '' end),
\n            --Installed=(case when css.Status=3 then '*' else '' end),
\n            Expired = case when ui.Isexpired = 0 then 'NO' else 'YES' end,
\n\t\t\tSuperseded = case when ui.isSuperseded = 0 then 'NO' else 'YES' end,
\n\t\t\tIsDeployed = case when ui.IsDeployed = 0 then 'NO' else 'YES' end,
\n            IsRequired=(case when css.Status=2 then '*' else '' end),
\n\t\t\tcss.LastStatusCheckTime as 'PatchInstallDate',
\n\t\t\tcss.LastStatusChangeTime as 'LastStateChange',
\n            Deadline=cdl.Deadline,
\n            ws.LastHWScan as 'SCCM Last Hardware Inventory',
\n            Dateadd(hour,(datediff(hour,getutcdate(),getdate())),uss.lastscantime) as 'Last WSUS Scan'
\n            , scan.StateName 'WSUSscan_State'
\n\t\t\t, scan.ErrorStatusID
\n\t\t\t, scan.ErrorCode
\n\t\t\t, scan.HexErrorCode,
\n--\t\t\tmaint.MaintenanceWindowName as 'CEPSWName', maint.Description, maint.StartTime, maint.DurationMinutes as 'DurationMinutes', maint.Enabled as 'CEPSWEnabled',
\n            ui.CI_UniqueID as UniqueUpdateID,
\n\t\t\tui.InfoURL as InformationURL
\nfrom v_Update_ComplianceStatusall css
\njoin v_R_System Rsys on css.ResourceID = Rsys.ResourceID
\njoin v_UpdateInfo ui on ui.CI_ID=css.CI_ID
\njoin v_CIRelation cir on cir.ToCIID = ui.CI_ID
\njoin v_CICategories_All catall on catall.CI_ID=ui.CI_ID 
\njoin v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company' 
\njoin v_CICategories_All catall2 on catall2.CI_ID=ui.CI_ID 
\njoin v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName='UpdateClassification' 
\n--left join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = @RscID
\nleft join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = rsys.ResourceID
\nleft join (
\n                        select atc.CI_ID, Deadline=min(a.EnforcementDeadline) from v_CIAssignment a
\n                        join v_CIAssignmentToCI atc on atc.AssignmentID=a.AssignmentID
\n                        group by atc.CI_ID) cdl   on cdl.CI_ID=css.CI_ID
\n--where  css.ResourceID = @RscID 
\n/*
\nleft join (
\n\t\t\tselect fcm.resourceid, sw.Name as 'MaintenanceWindowName', sw.Description, sw.StartTime, sw.Duration as 'DurationMinutes', sw.IsEnabled as 'Enabled',case when sw.RecurrenceType = 1 then 'No Recurrence'
\n\t\t\twhen sw.RecurrenceType = 2 then 'Daily'
\n\t\t\twhen sw.RecurrenceType = 3 then 'Weekly'
\n\t\t\twhen sw.RecurrenceType = 4 then 'Monthly'
\n\t\t\telse 'Unkwnon' end as RecurrenceType, case when sw.ServiceWindowType=5 then '*' else ' ' end as 'OSDServiceWindow'
\n\t\t\t, col.name as 'CollectionName'
\n\t\t\t, col.CollectionID
\n\t\t\tfrom v_ServiceWindow sw
\n\t\t\tjoin v_FullCollectionMembership fcm on sw.CollectionID = fcm.CollectionID
\n\t\t\tjoin v_Collection col
\n\t\t\ton sw.collectionid = col.collectionid
\n\t\t\twhere sw.Name &lt;&gt; 'NO RUN'
\n\t\t\t) Maint on maint.ResourceID = Rsys.ResourceID
\n*/
\nleft join \tv_GS_WORKSTATION_STATUS ws on Rsys.ResourceID = ws.ResourceID
\nleft join \tv_UpdateScanStatus uss on Rsys.ResourceID = uss.ResourceID
\nleft join
\n(
\nselect uss.ResourceID, SN.StateName, uss.LastStatusMessageID&amp;0x0000FFFF as ErrorStatusID,
\n\tisnull(uss.LastErrorCode,0) as ErrorCode,
\n\tdbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0))) as HexErrorCode
\n from v_UpdateScanStatus uss
\n\tjoin v_R_System rsys on rsys.ResourceID = uss.ResourceID and isnull(rsys.Obsolete0,0)&lt;&gt;1
\n\tjoin v_SoftwareUpdateSource sus on uss.UpdateSource_ID = sus.UpdateSource_ID 
\n\tjoin v_RA_System_SMSAssignedSites sass on uss.ResourceID = sass.ResourceID
\n\tjoin v_StateNames sn on sn.TopicType = 501 and 
\n\t\tsn.StateID = (case when (isnull(uss.LastScanState, 0)=0 and Left(isnull(rsys.Client_Version0, '4.0'), 1)&lt;'4') then 7 else isnull(uss.LastScanState, 0) end)
\nwhere 1= 1
\n\t--and (sass.SMS_Assigned_Sites0= 'P01')
\n\t--and (sn.StateName='Scan failed')
\n\tand (sus.UpdateSource_UniqueID = '{BE893E98-BD57-4E80-93F6-5D38B61C6069}')
\n) scan
\non Rsys.ResourceID = scan.ResourceID 
\nwhere  css.ResourceID = rsys.ResourceID
\nand ((css.Status=2))
\nand Rsys.Operating_System_Name_and0 not like '%server%'
\n--and (@Vendor = '' or catinfo.CategoryInstanceName = @Vendor)
\n--and (@UpdateClass = '' or catinfo2.CategoryInstanceName = @UpdateClass)
\nand cir.FromCIID in 
\n(
\nselect CI_ID
\nfrom v_AuthListInfo where Title like '%[Enter the portion of the title of the update lists you want displayed. Example:  if you had update lists titled "Servers - 2010", "Servers 2011", etc you could just enter %Servers%]%' and (Title not like '%test%' or title not like '%sandbox%')
\n)
\nand cir.RelationType=1
\nand (ui.DatePosted &lt;= (GETDATE()-30) or ui.DateRevised &lt;= (GETDATE()-30))
\n--and rsys.Name0 like 'SWMN00XB03231'
\n--order by  ui.BulletinID desc
\nand IsDeployed = 1
\nand rsys.Name0 in
\n\t(
\n\tselect Name
\n\tfrom dbo.v_FullCollectionMembership
\n\twhere CollectionID = @CollectionID
\n\t)
\norder by rsys.name0, ui.BulletinID desc
\nelse
\nselect distinct
\n\t\t\tRsys.name0 as 'Machine Name',
\n\t\t\tcatinfo.CategoryInstanceName as Vendor,
\n\t\t\tcatinfo2.CategoryInstanceName as UpdateClassification,
\n            ui.BulletinID as BulletinID,
\n            ui.ArticleID as ArticleID,
\n            ui.Title as Title,    
\n            ui.DatePosted,
\n            ui.DateRevised,        
\n            --Targeted=(case when ctm.ResourceID is not null then '*' else '' end),
\n            --Installed=(case when css.Status=3 then '*' else '' end),
\n            Expired = case when ui.Isexpired = 0 then 'NO' else 'YES' end,
\n\t\t\tSuperseded = case when ui.isSuperseded = 0 then 'NO' else 'YES' end,
\n\t\t\tIsDeployed = case when ui.IsDeployed = 0 then 'NO' else 'YES' end,
\n            IsRequired=(case when css.Status=2 then '*' else '' end),
\n\t\t\tcss.LastStatusCheckTime as 'PatchInstallDate',
\n\t\t\tcss.LastStatusChangeTime as 'LastStateChange',
\n            Deadline=cdl.Deadline,
\n            ws.LastHWScan as 'SCCM Last Hardware Inventory',
\n            Dateadd(hour,(datediff(hour,getutcdate(),getdate())),uss.lastscantime) as 'Last WSUS Scan'
\n            , scan.StateName 'WSUSscan_State'
\n\t\t\t, scan.ErrorStatusID
\n\t\t\t, scan.ErrorCode
\n\t\t\t, scan.HexErrorCode,
\n--\t\t\tmaint.MaintenanceWindowName as 'CEPSWName', maint.Description, maint.StartTime, maint.DurationMinutes as 'DurationMinutes', maint.Enabled as 'CEPSWEnabled',
\n            ui.CI_UniqueID as UniqueUpdateID,
\n\t\t\tui.InfoURL as InformationURL
\nfrom v_Update_ComplianceStatusall css
\njoin v_R_System Rsys on css.ResourceID = Rsys.ResourceID
\njoin v_UpdateInfo ui on ui.CI_ID=css.CI_ID
\njoin v_CIRelation cir on cir.ToCIID = ui.CI_ID
\njoin v_CICategories_All catall on catall.CI_ID=ui.CI_ID 
\njoin v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company' 
\njoin v_CICategories_All catall2 on catall2.CI_ID=ui.CI_ID 
\njoin v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName='UpdateClassification' 
\n--left join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = @RscID
\nleft join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = rsys.ResourceID
\nleft join (
\n                        select atc.CI_ID, Deadline=min(a.EnforcementDeadline) from v_CIAssignment a
\n                        join v_CIAssignmentToCI atc on atc.AssignmentID=a.AssignmentID
\n                        group by atc.CI_ID) cdl   on cdl.CI_ID=css.CI_ID
\n--where  css.ResourceID = @RscID 
\n/*
\nleft join (
\n\t\t\tselect fcm.resourceid, sw.Name as 'MaintenanceWindowName', sw.Description, sw.StartTime, sw.Duration as 'DurationMinutes', sw.IsEnabled as 'Enabled',case when sw.RecurrenceType = 1 then 'No Recurrence'
\n\t\t\twhen sw.RecurrenceType = 2 then 'Daily'
\n\t\t\twhen sw.RecurrenceType = 3 then 'Weekly'
\n\t\t\twhen sw.RecurrenceType = 4 then 'Monthly'
\n\t\t\telse 'Unkwnon' end as RecurrenceType, case when sw.ServiceWindowType=5 then '*' else ' ' end as 'OSDServiceWindow'
\n\t\t\t, col.name as 'CollectionName'
\n\t\t\t, col.CollectionID
\n\t\t\tfrom v_ServiceWindow sw
\n\t\t\tjoin v_FullCollectionMembership fcm on sw.CollectionID = fcm.CollectionID
\n\t\t\tjoin v_Collection col
\n\t\t\ton sw.collectionid = col.collectionid
\n\t\t\twhere sw.Name &lt;&gt; 'NO RUN'
\n\t\t\t) Maint on maint.ResourceID = Rsys.ResourceID
\n*/
\nleft join \tv_GS_WORKSTATION_STATUS ws on Rsys.ResourceID = ws.ResourceID
\nleft join \tv_UpdateScanStatus uss on Rsys.ResourceID = uss.ResourceID
\nleft join
\n(
\nselect uss.ResourceID, SN.StateName, uss.LastStatusMessageID&amp;0x0000FFFF as ErrorStatusID,
\n\tisnull(uss.LastErrorCode,0) as ErrorCode,
\n\tdbo.fnConvertBinaryToHexString(convert(VARBINARY(8), isnull(uss.LastErrorCode,0))) as HexErrorCode
\n from v_UpdateScanStatus uss
\n\tjoin v_R_System rsys on rsys.ResourceID = uss.ResourceID and isnull(rsys.Obsolete0,0)&lt;&gt;1
\n\tjoin v_SoftwareUpdateSource sus on uss.UpdateSource_ID = sus.UpdateSource_ID 
\n\tjoin v_RA_System_SMSAssignedSites sass on uss.ResourceID = sass.ResourceID
\n\tjoin v_StateNames sn on sn.TopicType = 501 and 
\n\t\tsn.StateID = (case when (isnull(uss.LastScanState, 0)=0 and Left(isnull(rsys.Client_Version0, '4.0'), 1)&lt;'4') then 7 else isnull(uss.LastScanState, 0) end)
\nwhere 1= 1
\n\t--and (sass.SMS_Assigned_Sites0= 'P01')
\n\t--and (sn.StateName='Scan failed')
\n\tand (sus.UpdateSource_UniqueID = '{BE893E98-BD57-4E80-93F6-5D38B61C6069}')
\n) scan
\non Rsys.ResourceID = scan.ResourceID 
\nwhere  css.ResourceID = rsys.ResourceID
\nand ((css.Status=2))
\nand Rsys.Operating_System_Name_and0 not like '%server%'
\n--and (@Vendor = '' or catinfo.CategoryInstanceName = @Vendor)
\n--and (@UpdateClass = '' or catinfo2.CategoryInstanceName = @UpdateClass)
\n--and cir.FromCIID in 
\n--(
\n--select CI_ID
\n--from v_AuthListInfo where Title like '%Wintel%' and (Title not like '%test%' or title not like '%sandbox%')
\n--)
\n--and cir.RelationType=1
\nand (ui.DatePosted &lt;= (GETDATE()-30) or ui.DateRevised &lt;= (GETDATE()-30))
\n--and rsys.Name0 like 'SWMN00XB03231'
\n--order by  ui.BulletinID desc
\nand rsys.Name0 in
\n\t(
\n\tselect Name
\n\tfrom dbo.v_FullCollectionMembership
\n\twhere CollectionID = @CollectionID
\n\t)
\norder by rsys.name0, ui.BulletinID desc";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****</pre>
</div>
<ul><!--EndFragment--></ul>
<p><strong>States for a deployment</strong></p>
<p>This report returns the states for all software updates in the specified deployment for a specified collection</p>
<p>NOTE:&nbsp; This is a very process intensive query.&nbsp; DO NOT run this report against a large collection of machines.</p>
<p>This report will list the following information:</p>
<ul>
<li>ArticleID – example:&nbsp; 2393802</li>
<li>Bulletin ID – example MS11-011</li>
<li>Title</li>
<li>State Name – example “Update is installed” or “Update is downloaded”</li>
<li>Error Status ID</li>
<li>Update ID</li>
<li>Name – MachineName</li>
<li>Last Bootup Time – Datetime</li>
<li>SCCM Last Hardware Inventory – Datetime</li>
</ul>
<p>The report will have two prompts</p>
<ul>
<li>Deployment ID – this is the ID of the Update List you want to interrogate</li>
<li>Enter a business unit or CollectionID – This is the collection of machines you are interested in</li>
</ul>
<p>This report does not link to any other reports</p>
<p>Here is the report. You will need to do the following:</p>
<ul>
<li>Copy the contents of the report into Notepad
<li>Chose File &gt; Save As &gt; Save as type “All Files”
<li>Chose Unicode for the encoding type
<li>Save the file with a .MOF extension</li>
</ul>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:49707228-9614-4be8-8b2f-67098637f30b" class="wlWriterEditableSmartContent">
<pre class="brush: text;">// *********************************************************************************
//
//		Created by SMS Export object wizard
//
//		Wednesday, January 18, 2012 created
//
//		File Name: States for a deployment.MOF
//
// Comments :
//
//
// *********************************************************************************


// ***** Class : SMS_Report *****
[SecurityVerbs(140551)]
instance of SMS_Report
{
	Category = "Software Updates";
	Comment = "This report returns the states for all software updates in the specified deployment for a specified collection";
	DrillThroughColumns = {};


	GraphCaption = "";
	GraphXCol = 1;
	GraphYCol = 2;
	MachineDetail = FALSE;
	MachineSource = FALSE;
	Name = "States for a deployment";
	NumPrompts = 2;
	RefreshInterval = 0;
	ReportGUID = "{CA6D9DC9-B7F4-4AA4-AE42-1B2892301B79}";
	
	ReportParams = {
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Deployment ID (Required)";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '') 
\nselect 
\ncia.Assignment_UniqueID as DeploymentID , cia.AssignmentName as DeploymentName
\nfrom v_CIAssignment cia
\nwhere cia.UpdateAssignment=1 and AssignmentName like '%[Enter the portion of the title of the update lists you want displayed. Example:  if you had update lists titled "Servers - 2010", "Servers 2011", etc you could just enter %Servers%]%'
\norder by AssignmentName
\nelse
\nselect 
\ncia.Assignment_UniqueID as DeploymentID , cia.AssignmentName as DeploymentName
\nfrom v_CIAssignment cia
\nwhere cia.UpdateAssignment=1
\nand Assignment_UniqueID like @__filterwildcard or AssignmentName like @__filterwildcard
\norder by AssignmentName
\nend";
	VariableName = "DEPLOYMENTID";
}, 
instance of SMS_ReportParameter
{
	AllowEmpty = FALSE;
	DefaultValue = "";
	PromptText = "Enter a business unit or Collection ID";
	SampleValueSQL = "begin
\n if (@__filterwildcard = '')
\n  select distinct a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  where (b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]' or b.parentcollectionID = '[Enter the parent collection ID of your business unit collections.  Example:  Create an empty collection called "Business Units".  Then create multiple sub collections that represent your various business units]') and a.name not like '%No Client%' 
\nor a.collectionID in (select collectionID from v_SCCM_WintelPatchWindowCollections)
\n  order by a.Name
\n else
\n  select a.collectionID, a.name
\n  from v_collection a
\n  join v_CollectToSubCollect b
\n  on a.collectionID = b.subcollectionid
\n  WHERE a.CollectionID like @__filterwildcard
\n  order by a.Name
\nend";
	VariableName = "CollectionID";
}};
	SecurityKey = "";
	SQLQuery = "select 
\nui.ArticleID as ArticleID,
\nui.BulletinID as BulletinID,
\nui.Title as Title,
\nsn.StateName as Status,
\nucs.LastEnforcementStatusMsgID&amp;0x0000FFFF as ErrorStatusID,
\nui.CI_UniqueID as UniqueUpdateID,
\ncol.name,
\nos.LastBootUpTime0 as 'LastBootUpTime',
\nws.LastHWScan as 'SCCM Last Hardware Inventory'
\nfrom v_CIAssignment a
\njoin v_CIAssignmentToCI aci
\n   on aci.AssignmentID=a.AssignmentID
\njoin v_CIAssignmentTargetedMachines atm
\n   on atm.AssignmentID=a.AssignmentID
\njoin v_UpdateState_Combined ucs
\n   on ucs.CI_ID=aci.CI_ID and ucs.ResourceID=atm.ResourceID
\njoin v_StateNames sn
\n   on sn.StateID=ucs.StateID and sn.TopicType=ucs.StateType
\njoin v_UpdateInfo ui
\n   on ui.CI_ID=aci.CI_ID
\nleft join   v_GS_Operating_System os on atm.ResourceID = os.resourceid
\nleft join \tv_GS_WORKSTATION_STATUS ws on atm.ResourceID = ws.ResourceID
\nleft join v_FullCollectionMembership Col
\non atm.ResourceID = col.ResourceID
\nwhere (a.Assignment_UniqueID = @DEPLOYMENTID)  and col. CollectionID = @CollectionID
\norder by ui.ArticleID";
	StatusMessageDetailSource = FALSE;
	UnicodeData = FALSE;
	XColLabel = "";
	YColLabel = "";
};
// ***** End *****</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mteegarden.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mteegarden.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=emptygarden.info&#038;blog=15160604&#038;post=107&#038;subd=mteegarden&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://emptygarden.info/2012/01/18/software-update-reports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/34712f0b9a1356e013225e27f2127bd6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mteegarden</media:title>
		</media:content>
	</item>
	</channel>
</rss>
