<?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/"
	>

<channel>
	<title>PeetersOnline &#187; WSUS</title>
	<atom:link href="http://www.peetersonline.nl/index.php/tag/wsus/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peetersonline.nl</link>
	<description>Using Powershell for (virtually) everything!</description>
	<lastBuildDate>Fri, 19 Aug 2011 09:22:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Synchronize WSUS with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/powershell/synchronize-wsus-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/powershell/synchronize-wsus-with-powershell/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 07:05:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[WSUS]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=374</guid>
		<description><![CDATA[Yesterday, I showed you how to script the WSUS Cleanup Wizard with Powershell. Today, the WSUS fun continues! Here&#8217;s how to use powershell to &#8220;manually&#8221; synchronize your WSUS server, i.e. download the latest updates. #Region VARIABLES &#160; # WSUS Connection Parameters: &#91;String&#93;$updateServer = &#34;myWSUSServer.domain.local&#34; &#91;Boolean&#93;$useSecureConnection = $False &#91;Int32&#93;$portNumber = 80 &#160; #EndRegion VARIABLES &#160; #Region <a href='http://www.peetersonline.nl/index.php/powershell/synchronize-wsus-with-powershell/'>[...]</a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.peetersonline.nl/index.php/powershell/wsus-cleanup-with-powershell/">Yesterday</a>, I showed you how to script the WSUS Cleanup Wizard with <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a>. Today, the WSUS fun continues! Here&#8217;s how to use <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>powershell</a> to &#8220;manually&#8221; synchronize your WSUS server, i.e. download the latest updates.</p>
<p><span id="more-374"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#Region VARIABLES</span>
&nbsp;
<span style="color: #008000;"># WSUS Connection Parameters:</span>
<span style="color: #000000;">&#91;</span><span style="color: #008080;">String</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$updateServer</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;myWSUSServer.domain.local&quot;</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$useSecureConnection</span> <span style="color: pink;">=</span> <span style="color: #800080;">$False</span>
<span style="color: #000000;">&#91;</span>Int32<span style="color: #000000;">&#93;</span><span style="color: #800080;">$portNumber</span> <span style="color: pink;">=</span> <span style="color: #804000;">80</span>
&nbsp;
<span style="color: #008000;">#EndRegion VARIABLES</span>
&nbsp;
<span style="color: #008000;">#Region SCRIPT</span>
&nbsp;
<span style="color: #008000;"># Load .NET assembly</span>
<span style="color: #000000;">&#91;</span>void<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>reflection.assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">LoadWithPartialName</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.UpdateServices.Administration&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Connect to WSUS Server</span>
<span style="color: #800080;">$Wsus</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.AdminProxy<span style="color: #000000;">&#93;</span>::getUpdateServer<span style="color: #000000;">&#40;</span><span style="color: #800080;">$updateServer</span><span style="color: pink;">,</span><span style="color: #800080;">$useSecureConnection</span><span style="color: pink;">,</span><span style="color: #800080;">$portNumber</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Perform Synchronization</span>
<span style="color: #800080;">$Subscription</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Wsus</span>.GetSubscription<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$Subscription</span>.StartSynchronization<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;">#EndRegion SCRIPT</span></pre></div></div>

<p>Download the script here: <a href='http://www.peetersonline.nl/wp-content/synchronize-wsus.txt'>Synchronize-Wsus (rename to .ps1)</a></p>
<p>Enjoy!<br />
Hugo</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/powershell/synchronize-wsus-with-powershell/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WSUS Cleanup with Powershell</title>
		<link>http://www.peetersonline.nl/index.php/powershell/wsus-cleanup-with-powershell/</link>
		<comments>http://www.peetersonline.nl/index.php/powershell/wsus-cleanup-with-powershell/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 06:51:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[WSUS]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.peetersonline.nl/?p=369</guid>
		<description><![CDATA[If you manage a Windows Server Update Services (WSUS) server, you probably run the Server Cleanup Wizard every once and a while. It removes old and superseded updates and computers that haven&#8217;t reported their status for more than 30 days. Wouldn&#8217;t it be nice to schedule such a cleanup to run every month? Too bad <a href='http://www.peetersonline.nl/index.php/powershell/wsus-cleanup-with-powershell/'>[...]</a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>If you manage a Windows Server Update Services (WSUS) server, you probably run the Server Cleanup Wizard every once and a while. It removes old and superseded updates and computers that haven&#8217;t reported their status for more than 30 days. Wouldn&#8217;t it be nice to schedule such a cleanup to run every month? Too bad there&#8217;s no command line tool I know of that can help you out with this. <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a> to the rescue!<br />
<a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target='_blank'>Powershell</a> can not only run the built-in commandlets or even those added by snapins. It can leverage the full power of the .NET Framework. Browse the <a href="http://msdn.microsoft.com/en-us/library/default.aspx">MSDN Library</a> if you want to find more cool things you can do with it. Here&#8217;s a script that uses this information to run the cleanup wizard:</p>
<p><span id="more-369"></span></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#Region VARIABLES</span>
&nbsp;
<span style="color: #008000;"># WSUS Connection Parameters:</span>
<span style="color: #000000;">&#91;</span><span style="color: #008080;">String</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$updateServer</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;myWSUSServer.domain.local&quot;</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$useSecureConnection</span> <span style="color: pink;">=</span> <span style="color: #800080;">$False</span>
<span style="color: #000000;">&#91;</span>Int32<span style="color: #000000;">&#93;</span><span style="color: #800080;">$portNumber</span> <span style="color: pink;">=</span> <span style="color: #804000;">80</span>
&nbsp;
<span style="color: #008000;"># Cleanup Parameters:</span>
<span style="color: #008000;"># Decline updates that have not been approved for 30 days or more, are not currently needed by any clients, and are superseded by an aproved update.</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$supersededUpdates</span> <span style="color: pink;">=</span> <span style="color: #800080;">$True</span>
<span style="color: #008000;"># Decline updates that aren't approved and have been expired my Microsoft.</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$expiredUpdates</span> <span style="color: pink;">=</span> <span style="color: #800080;">$True</span>
<span style="color: #008000;"># Delete updates that are expired and have not been approved for 30 days or more.</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$obsoleteUpdates</span> <span style="color: pink;">=</span> <span style="color: #800080;">$True</span>
<span style="color: #008000;"># Delete older update revisions that have not been approved for 30 days or more.</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$compressUpdates</span> <span style="color: pink;">=</span> <span style="color: #800080;">$True</span>
<span style="color: #008000;"># Delete computers that have not contacted the server in 30 days or more.</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$obsoleteComputers</span> <span style="color: pink;">=</span> <span style="color: #800080;">$True</span>
<span style="color: #008000;"># Delete update files that aren't needed by updates or downstream servers.</span>
<span style="color: #000000;">&#91;</span>Boolean<span style="color: #000000;">&#93;</span><span style="color: #800080;">$unneededContentFiles</span> <span style="color: pink;">=</span> <span style="color: #800080;">$True</span>
&nbsp;
<span style="color: #008000;">#EndRegion VARIABLES</span>
&nbsp;
<span style="color: #008000;">#Region SCRIPT</span>
&nbsp;
<span style="color: #008000;"># Load .NET assembly</span>
<span style="color: #000000;">&#91;</span>void<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>reflection.assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">LoadWithPartialName</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.UpdateServices.Administration&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Connect to WSUS Server</span>
<span style="color: #800080;">$Wsus</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.AdminProxy<span style="color: #000000;">&#93;</span>::getUpdateServer<span style="color: #000000;">&#40;</span><span style="color: #800080;">$updateServer</span><span style="color: pink;">,</span><span style="color: #800080;">$useSecureConnection</span><span style="color: pink;">,</span><span style="color: #800080;">$portNumber</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Perform Cleanup</span>
<span style="color: #800080;">$CleanupManager</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Wsus</span>.GetCleanupManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$CleanupScope</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> Microsoft.UpdateServices.Administration.CleanupScope<span style="color: #000000;">&#40;</span><span style="color: #800080;">$supersededUpdates</span><span style="color: pink;">,</span><span style="color: #800080;">$expiredUpdates</span><span style="color: pink;">,</span><span style="color: #800080;">$obsoleteUpdates</span><span style="color: pink;">,</span><span style="color: #800080;">$compressUpdates</span><span style="color: pink;">,</span><span style="color: #800080;">$obsoleteComputers</span><span style="color: pink;">,</span><span style="color: #800080;">$unneededContentFiles</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$CleanupManager</span>.PerformCleanup<span style="color: #000000;">&#40;</span><span style="color: #800080;">$CleanupScope</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;">#EndRegion SCRIPT</span></pre></div></div>

<p>Download it here: <a href="http://www.peetersonline.nl/wp-content/cleanup-wsus.txt">Cleanup-Wsus (rename to .ps1)</a></p>
<p>Happy scheduling!</p>
<p>Hugo</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.peetersonline.nl/index.php/powershell/wsus-cleanup-with-powershell/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

