<?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>PhishThis! &#187; PowerShell 2.0 CTP</title>
	<atom:link href="http://www.phishthis.com/category/powershell-20-ctp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phishthis.com</link>
	<description></description>
	<lastBuildDate>Tue, 22 Feb 2011 05:48:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Powershell 2.0 CTP &#8211; Remoting &#8211; PowerShell Remove WDS</title>
		<link>http://www.phishthis.com/2007/11/20/powershell-20-ctp-remoting-powershell-remove-wds/</link>
		<comments>http://www.phishthis.com/2007/11/20/powershell-20-ctp-remoting-powershell-remove-wds/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 22:47:07 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[PowerShell 2.0 CTP]]></category>
		<category><![CDATA[Server Management]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Script]]></category>
		<category><![CDATA[Remove WDS Script]]></category>
		<category><![CDATA[scripting to uninstall wds]]></category>
		<category><![CDATA[WDS Removal]]></category>
		<category><![CDATA[WSUS WDS]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/2007/11/20/powershell-20-ctp-remoting-powershell-remove-wds/</guid>
		<description><![CDATA[<p>So, with PowerShell 2.0 CTP&#8217;s arrival, and me finally having some time to mess around with some of the new features, here&#8217;s my previous (and first popular) post re-hashed for PowerShell 2.0 CTP. This will only work on machines with WS-Management installed, so it probably won&#8217;t work on most of your machines (unless you&#8217;ve deployed [...]]]></description>
			<content:encoded><![CDATA[<p>So, with PowerShell 2.0 CTP&#8217;s arrival, and me finally having some time to mess around with some of the new features, here&#8217;s my previous (and first popular) post re-hashed for PowerShell 2.0 CTP. This will only work on machines with WS-Management installed, so it probably won&#8217;t work on most of your machines (unless you&#8217;ve deployed it), but it works well in my little test world. It utilizes two new features. These features are the [ADSISearcher] and Invoke-Expression. Instead of creating all of the Directory Service objects each time, you can just cast the ASDISearcher type and you&#8217;re done. Invoke-Expression allows you to use the -computer parameter and pass one, or many, computers to the cmdlet. I chose to use a single command here.</p>
<p><code><br />
[adsisearcher]$searcher = "LDAP://dc=foo,dc=bar,dc=com"<br />
$searcher.filter = "(objectclass=computer)"<br />
foreach ($machine in ($searcher.findall()))<br />
{<br />
   invoke-expression -computer $machine.properties.cn -command "c:\windows\`$NtUninstallKB917013`$\spuninst\spuninst.exe /q /norestart"<br />
}</code></p>
<p>I haven&#8217;t had a chance to test it, but you could use mutiple computers. We could change the foreach loop to write to a text file, then read that file for the computer names.</p>
<p><code>...<br />
foreach ($machine in ($searcher.findall())){ add-content c:\temp\machines.txt "$($machine.properties.cn)" }<br />
invoke-expression -computer (get-content c:\temp\machines.txt) -command "c:\windows\`$NtUninstallKB917013`$\spuninst\spuninst.exe /q /norestart"<br />
</code></p>
<p>That&#8217;ll kick off on 50 machines at a time. You can adjust that via the -ThrottleLimit parameter, and make it more or less, depending on bandwidth, CPU power, etc.</p>
<p>As you can see, I tend to learn better by example or by practical application. You&#8217;ll never see me write a book :) More soon!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2007/11/20/powershell-20-ctp-remoting-powershell-remove-wds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

