<?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>Get-PowerShell &#187; Powershell</title>
	<atom:link href="http://get-powershell.com/category/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://get-powershell.com</link>
	<description></description>
	<lastBuildDate>Sat, 10 Jul 2010 15:44:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Pull PCI Bus information for Network Cards with PowerShell</title>
		<link>http://get-powershell.com/2010/04/07/pull-pci-bus-information-for-network-cards-with-powershell/</link>
		<comments>http://get-powershell.com/2010/04/07/pull-pci-bus-information-for-network-cards-with-powershell/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 14:58:31 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[PCI Bus]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2010/04/07/pull-pci-bus-information-for-network-cards-with-powershell/</guid>
		<description><![CDATA[Since its been about 3 months, I figured its about time for another post. A few weeks ago, a colleague of mine and I were discussing ways to identify which network cards were which when we build new Hyper-V cluster nodes. It can get a little nuts when you have 2 iSCSI networks, 1 Corp [...]]]></description>
			<content:encoded><![CDATA[<p align="left">Since its been about 3 months, I figured its about time for another post. A few weeks ago, a colleague of mine and I were discussing ways to identify which network cards were which when we build new Hyper-V cluster nodes. It can get a little nuts when you have 2 iSCSI networks, 1 Corp connection, and one connection that is tagged for VM’s on different VLAN’s, and a Heartbeat network. </p>
<p align="left">We found that there is no real way to predict which NIC will be named “Local Area Connection”, “Local Area Connection 2”, Local Area Connection N …” and so on. However, poking around we did find that there is one thing in common across all of our servers. Assuming the NICS were all plugged into the switch in order, we could identify them by their PCI bus, device, and function ID as shown in the screenshot below.</p>
<p align="left"><a href="http://get-powershell.com/wp-content/uploads/2010/04/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/04/image_thumb.png" width="345" height="387" /></a> </p>
<p>Well that’s all good but how can we leverage that information and automate our network configuration for new cluster nodes. First, we need to come up with a standard. We know the PCI Bus information for each NIC in the server. Once we made that map, we can specify which NIC gets which IP Address.&#160; Once you manually create that map, you still need a way to identify which NIC has what Bus information. Enter PowerShell.</p>
<p>This gets a little nuts because we have to piece this together from a couple different sources. The first bit of information that we need for each NIC is something called the PnPDeviceID. You can pull this wit WMI using the win32_networkAdapter class.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2010/04/image1.png"><img style="border-bottom: 0px; border-left: 0px; width: 706px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/04/image_thumb1.png" width="644" height="152" /></a> </p>
<p>So what does this buy us. It turns out this is part of the path in the registry that stores the PCI bus information. Lets assume you store the PnPDeviced id in $deviceID. You can get the PCI Bus information with the following:</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2010/04/image2.png"><img style="border-bottom: 0px; border-left: 0px; width: 638px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/04/image_thumb2.png" width="641" height="377" /></a> </p>
<p>Those last 3 numbers that are circled in red are the BusID, DeviceID, and FunctionID. Note that this is for 2008 and 2008 R2. All I really need is those last 3 numbers so some regex trickery along with multi-variable assignment comes in pretty handy here.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2010/04/image3.png"><img style="border-bottom: 0px; border-left: 0px; width: 672px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/04/image_thumb3.png" width="643" height="443" /></a> </p>
<p>So once we have that, we can put this all together in a couple functions</p>
<p>&#160;</p>
<div style="border-bottom: black 1px solid; border-left: black 1px solid; padding-bottom: 5px; padding-left: 5px; width: 750px; padding-right: 5px; font-family: consolas,lucida console; font-size: 10pt; overflow: auto; border-top: black 1px solid; border-right: black 1px solid; padding-top: 5px">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas,lucida console; background: #cecece; font-size: 10pt; padding-top: 5px">001             <br />002              <br />003              <br />004              <br />005              <br />006              <br />007              <br />008              <br />009              <br />010              <br />011              <br />012              <br />013              <br />014              <br />015              <br />016              <br />017              <br />018              <br />019              <br />020              <br />021              <br />022              <br />023              <br />024              <br />025              <br />026              <br />027              <br />028              <br />029              <br />030              <br />031              <br />032              <br />033              <br />034              <br />035              <br />036              <br />037              <br />038              <br />039              <br />040              <br />041              <br />042              <br />043              </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas,lucida console; background: black; font-size: 10pt; padding-top: 5px"><span style="color: #ffde00">Function</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">Get-NicBusFunctionID</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span>              <br /><span style="color: #00d42d">$adapters</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #ffff60">get-wmiobject</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">win32_networkadapter</span><span style="color: #ffffff">&#160;</span><span style="color: #ffde00">-filter</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">&quot;netenabled=true&quot;</span>              </p>
<p><span style="color: #ffde00">foreach</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">(</span><span style="color: #00d42d">$adapter</span><span style="color: #ffffff">&#160;</span><span style="color: #ffde00">in</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$adapters</span><span style="color: #ffffff">)</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160; </span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">$deviceId</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$adapter</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">PnPDeviceID</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">$locationInfo</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">(</span><span style="color: #ffff60">get-itemproperty</span><span style="color: #ffffff">&#160;</span><span style="color: #ffde00">-path</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">&quot;HKLM:\SYSTEM\CurrentControlSet\Enum\$deviceID&quot;</span><span style="color: #ffffff">&#160;</span>`              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ffde00">-name</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">locationinformation</span><span style="color: #ffffff">)</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">locationINformation</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">$businfo</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #ffff60">Resolve-PCIBusInfo</span><span style="color: #ffffff">&#160;</span><span style="color: #ffde00">-locationInfo</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$locationinfo</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ffff60">new-object</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">psobject</span><span style="color: #ffffff">&#160;</span><span style="color: #ffde00">-property</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">@{</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;Name&quot;</span><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$adapter</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">NetConnectionID</span><span style="color: #ffffff">;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;MacAddress&quot;</span><span style="color: #ffffff">&#160; </span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$adapter</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">MacAddress</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;Index&quot;</span><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$adapter</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">Index</span><span style="color: #ffffff">;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;PCIBusID&quot;</span><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160; </span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$businfo</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">BusID</span><span style="color: #ffffff">;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;PCIDeviceID&quot;</span><span style="color: #ffffff">&#160;&#160; </span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$businfo</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">DeviceID</span><span style="color: #ffffff">;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;PCIFunctionID&quot;</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$businfo</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">FunctionID</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ffffff">}</span>              <br /><span style="color: #ffffff">}</span>              </p>
<p><span style="color: #ffffff">}</span>              </p>
<p><span style="color: #ffde00">Function</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">Resolve-PCIBusInfo</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span>              </p>
<p><span style="color: #ffde00">param</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">(</span>              <br /><span style="color: #a9a9a9">[</span><span style="color: #84a7c1">parameter</span><span style="color: #ffffff">(</span><span style="color: #ffffff">ValueFromPipeline</span><span style="color: #a9a9a9">=</span><span style="color: #00d42d">$true</span><span style="color: #a9a9a9">,</span><span style="color: #ffffff">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #00d42d">$true</span><span style="color: #ffffff">)</span><span style="color: #a9a9a9">]</span>              <br /><span style="color: #84a7c1">[string]</span>              <br /><span style="color: #00d42d">$locationInfo</span>              <br /><span style="color: #ffffff">)</span>              <br /><span style="color: #ffde00">PROCESS</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span>              <br /><span style="color: #84a7c1">[void]</span><span style="color: #ffffff">(</span><span style="color: #00d42d">$locationInfo</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">-match</span><span style="color: #ffffff">&#160; </span><span style="color: #00d42d">&quot;\d,\d,\d&quot;</span><span style="color: #ffffff">)</span>              <br /><span style="color: #00d42d">$busId</span><span style="color: #a9a9a9">,</span><span style="color: #00d42d">$deviceID</span><span style="color: #a9a9a9">,</span><span style="color: #00d42d">$functionID</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$matches</span><span style="color: #a9a9a9">[</span><span style="color: #98fe1e">0</span><span style="color: #a9a9a9">]</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">-split</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">&quot;,&quot;</span>              </p>
<p><span style="color: #ffff60">new-object</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">psobject</span><span style="color: #ffffff">&#160;</span><span style="color: #ffde00">-property</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">@{</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;BusID&quot;</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$busID</span><span style="color: #ffffff">;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;DeviceID&quot;</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">&quot;$deviceID&quot;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #00d42d">&quot;FunctionID&quot;</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">&quot;$functionID&quot;</span>              <br /><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ffffff">}</span>              <br /><span style="color: #ffffff">}</span><span style="color: #ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>              <br /><span style="color: #ffffff">}</span>              </p>
<p></div>
</td>
</tr>
</tbody>
</table></div>
</p>
</p>
<p>And a screenshot of how to use it</p>
<p> <a href="http://get-powershell.com/wp-content/uploads/2010/04/image4.png"><img style="border-bottom: 0px; border-left: 0px; width: 385px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/04/image_thumb4.png" width="391" height="239" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2010/04/07/pull-pci-bus-information-for-network-cards-with-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Determining if IP addresses are on the same subnet</title>
		<link>http://get-powershell.com/2010/01/29/determining-if-ip-addresses-are-on-the-same-subnet/</link>
		<comments>http://get-powershell.com/2010/01/29/determining-if-ip-addresses-are-on-the-same-subnet/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 15:05:47 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[System.Net.IPAddress]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2010/01/29/determining-if-ip-addresses-are-on-the-same-subnet/</guid>
		<description><![CDATA[This is actually a fairly simple task that many people have done in many different languages. However, I thought it would be useful to share for the sake of showing how .NET can do a lot of tedious work for us. IP Addresses are made up of 32 bits. Subnet masks are 32 bits as [...]]]></description>
			<content:encoded><![CDATA[<p>This is actually a fairly simple task that many people have done in many different languages. However, I thought it would be useful to share for the sake of showing how .NET can do a lot of tedious work for us. </p>
<p> IP Addresses are made up of 32 bits. Subnet masks are 32 bits as well. The subnet mask is what is used to determine where the Network ID ends and the host ID begins. Masks must have contiguous 1’s. If there is a 1 in the mask, then the corresponding bit in the IP Address is part of the Network ID. If there is 0 in the mask, the corresponding bit in the IP Address is part of the host ID.</p>
<p> So obviously there is going to be a lot of binary math, which any good network engineer can do. However, if you can get it for free, even better!</p>
<p> There is a type in .NET called System.Net.IPAddress that has several useful properties. The one I will focus on is Address.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2010/01/image.png"><img style="border-right-width: 0px; width: 638px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/01/image_thumb.png" width="638" height="376" /></a></p>
<p> Using the Address property and some bitwise operators in PowerShell, we can come up with a function pretty quickly. The –and and –or operators are pretty commonplace in the world of PowerShell but there is occasionally a need to do a compare of two numbers at the bit level. This is done with the –band and –bor operators. I may be off but if memory serves, using –bor and –band you can build any other bit function like xor. I won’t event think about <a href="http://en.wikipedia.org/wiki/Karnaugh_map">K-maps</a>.</p>
<p> So with all that, here is some code:</p>
<div style="border-bottom: black 1px solid; border-left: black 1px solid; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas, lucida console; font-size: 10pt; overflow: auto; border-top: black 1px solid; border-right: black 1px solid; padding-top: 5px">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas, lucida console; background: #cecece; font-size: 10pt; padding-top: 5px">001              <br />002               <br />003               <br />004               <br />005               <br />006               <br />007               <br />008               <br />009               <br />010               <br />011               <br />012               <br />013               <br />014               <br />015               <br />016               <br />017               <br />018               <br />019               <br />020               </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas, lucida console; background: black; font-size: 10pt; padding-top: 5px"><span style="color: #ffde00">Function</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">Test-SameSubnet</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span>               <br /><span style="color: #ffde00">param</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">(</span>               <br /><span style="color: #a9a9a9">[</span><span style="color: #84a7c1">parameter</span><span style="color: #ffffff">(</span><span style="color: #ffffff">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #00d42d">$true</span><span style="color: #ffffff">)</span><span style="color: #a9a9a9">]</span>               <br /><span style="color: #84a7c1">[Net.IPAddress]</span>               <br /><span style="color: #00d42d">$ip1</span><span style="color: #a9a9a9">,</span>               </p>
<p><span style="color: #a9a9a9">[</span><span style="color: #84a7c1">parameter</span><span style="color: #ffffff">(</span><span style="color: #ffffff">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #00d42d">$true</span><span style="color: #ffffff">)</span><span style="color: #a9a9a9">]</span>               <br /><span style="color: #84a7c1">[Net.IPAddress]</span>               <br /><span style="color: #00d42d">$ip2</span><span style="color: #a9a9a9">,</span>               </p>
<p><span style="color: #a9a9a9">[</span><span style="color: #84a7c1">parameter</span><span style="color: #ffffff">(</span><span style="color: #ffffff">)</span><span style="color: #a9a9a9">]</span>               <br /><span style="color: #a9a9a9">[</span><span style="color: #84a7c1">alias</span><span style="color: #ffffff">(</span><span style="color: #00d42d">&quot;SubnetMask&quot;</span><span style="color: #ffffff">)</span><span style="color: #a9a9a9">]</span>               <br /><span style="color: #84a7c1">[Net.IPAddress]</span>               <br /><span style="color: #00d42d">$mask</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #00d42d">&quot;255.255.255.0&quot;</span>               <br /><span style="color: #ffffff">)</span>               </p>
<p><span style="color: #ffde00">if</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">(</span><span style="color: #ffffff">(</span><span style="color: #00d42d">$ip1</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">address</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">-band</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$mask</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">address</span><span style="color: #ffffff">)</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">-eq</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">(</span><span style="color: #00d42d">$ip2</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">address</span><span style="color: #ffffff">&#160;</span><span style="color: #a9a9a9">-band</span><span style="color: #ffffff">&#160;</span><span style="color: #00d42d">$mask</span><span style="color: #a9a9a9">.</span><span style="color: #ffffff">address</span><span style="color: #ffffff">)</span><span style="color: #ffffff">)</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span><span style="color: #00d42d">$true</span><span style="color: #ffffff">}</span>               <br /><span style="color: #ffde00">else</span><span style="color: #ffffff">&#160;</span><span style="color: #ffffff">{</span><span style="color: #00d42d">$false</span><span style="color: #ffffff">}</span>               </p>
<p><span style="color: #ffffff">}</span> </div>
</td>
</tr>
</tbody>
</table></div>
<p> The Address property is the binary number that represents the IP Address. Doing a bitwise AND with a mask will tell us if they are in the same subnet. I have a default value of 255.255.255.0 for the mask, or /24 if you prefer CIDR notation, but you can specify it as a parameter if you like.</p>
<p>&#160;<a href="http://get-powershell.com/wp-content/uploads/2010/01/image1.png"><img style="border-right-width: 0px; width: 638px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2010/01/image_thumb1.png" width="682" height="462" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2010/01/29/determining-if-ip-addresses-are-on-the-same-subnet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Specifying Listener IP Address for PowerShell Remoting</title>
		<link>http://get-powershell.com/2009/12/11/specifying-listener-ip-address-for-powershell-remoting/</link>
		<comments>http://get-powershell.com/2009/12/11/specifying-listener-ip-address-for-powershell-remoting/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 22:14:04 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Listeners]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[WinRM]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/12/11/specifying-listener-ip-address-for-powershell-remoting/</guid>
		<description><![CDATA[I have a lot of servers that have more than one network interface. For example, in my Hyper-V cluster, we might have iSCSI NICs, Live Migration NICs, Heartbeat NICs, and Client Access NICs. When I enabled remoting I was not comfortable with WinRM listening on all of the IP addresses on my server. I really [...]]]></description>
			<content:encoded><![CDATA[<p>I have a lot of servers that have more than one network interface. For example, in my Hyper-V cluster, we might have iSCSI NICs, Live Migration NICs, Heartbeat NICs, and Client Access NICs. When I enabled remoting I was not comfortable with WinRM listening on all of the IP addresses on my server. I really only wanted it to listen on 1 IP.</p>
<p>On my local machine, you can see that my listener is listening on any address it can find on my IP stack.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/12/image.png"><img style="border-bottom: 0px; border-left: 0px; width: 684px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/12/image_thumb.png" width="641" height="364" /></a> </p>
<p>I’d like to set this to only listen only on a single IP V4 Address. When I first tried to change this I started looking at the value for Address under my listener but kept running into an error that reads <font color="#ff0000">Set-Item : Item has already been added. Key in dictionary: &#8216;Address&#8217;&#160; Key being added: &#8216;Address&#8217;</font></p>
<p>Poking around the WSMAN provider, (which is fantastic by the way!) I found something else that looked promising. In WSMAN:\localhost\Service there are items called IPV4Filter and IPV6Filter. </p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/12/image1.png"><img style="border-bottom: 0px; border-left: 0px; width: 718px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/12/image_thumb1.png" width="642" height="393" /></a> </p>
<p>Sweet!&#160; Let’s try to set it to my local IP Address… and fail with this error</p>
<p><font color="#ff0000">Set-Item : The WinRM client cannot process the request. The IP Filter is invalid. Ranges are specified using the syntax IP1-IP2. Multiple ranges are separated using , as delimiter. * is used to indicate that the service should listen on all available IPs on the machine. When * is used, other ranges in the filter are ignored. If filter is blank,     <br /> the service doesn&#8217;t listen on any address. For example, if service should be restricted to listen on only IPv4 addresses, IPv6 filter should be left empty.</font> </p>
<p>But this is great news. The error message is actually helpful – Christmas miracle maybe?</p>
<p>If you want to listen on a single IP Address, you can specify a range that starts and ends at the same IP. For example, </p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/12/image2.png"><img style="border-bottom: 0px; border-left: 0px; width: 722px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/12/image_thumb2.png" width="644" height="392" /></a> </p>
<p>So why would you have to enter all these crazy ranges.? Well it turns out you can specify these in a GPO. Say you have a Hyper-V Cluster that has a client access network (10.10.10.0/24), an iSCSI network (10.11.11.0/24), and a few others for things like heartbeat and live migration.&#160; If you only wanted to have a listener on the client access network for all of your cluster nodes, you could specify the IPv4Filter to be 10.10.10.1- 10.10.10.254 and the policy would apply to all our servers and they would not be listening on the 10.11.11.0/24 iSCSI network.</p>
<p>To configure GPO settings, you can go to Computer Configuration\Administrative Templates\Windows Components\WinRM Service and in there you will find a setting called “Allow automatic configuration of listeners”</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/12/image3.png"><img style="border-bottom: 0px; border-left: 0px; width: 690px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/12/image_thumb3.png" width="644" height="589" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/12/11/specifying-listener-ip-address-for-powershell-remoting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Advanced Functions</title>
		<link>http://get-powershell.com/2009/11/30/powershell-advanced-functions/</link>
		<comments>http://get-powershell.com/2009/11/30/powershell-advanced-functions/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 14:45:29 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Advanced Function]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Screencast]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/11/30/powershell-advanced-functions/</guid>
		<description><![CDATA[A while back I posted a screencast on using the ISE for debugging. It seems like a lot of people enjoyed the video so I thought I would do another one. As a result, here is a Screencast that discusses Advanced Functions in PowerShell. I hope you find it helpful.]]></description>
			<content:encoded><![CDATA[<p>A while back I posted a screencast on <a href="http://get-powershell.com/2009/09/08/debugging-modules-with-the-powershell-ise-integrated-scripting-environment/">using the ISE for debugging</a>. It seems like a lot of people enjoyed the video so I thought I would do another one. As a result, here is a Screencast that discusses Advanced Functions in PowerShell. I hope you find it helpful.</p>
<p> <iframe style="width: 800px; height: 600px" src="http://silverlight.services.live.com/invoke/82115/PowerShell%20Advanced%20Functions/iframe.html" frameborder="0" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/11/30/powershell-advanced-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Seattle PowerShell Script Club &#8211; Thurs Nov 19th</title>
		<link>http://get-powershell.com/2009/11/06/seattle-powershell-script-club-thurs-nov-19th/</link>
		<comments>http://get-powershell.com/2009/11/06/seattle-powershell-script-club-thurs-nov-19th/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 18:03:45 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Script Club]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/11/06/seattle-powershell-script-club-thurs-nov-19th/</guid>
		<description><![CDATA[I am happy to announce that the Seattle PowerShell Script Club will be meeting on Thursday, Nov 19th at 818 Stewart St, Seattle WA from 7:00 PM to 9:00 PM and a good chance of heading out for beers when we’re done. James Brundage has released his Windows PowerShell Pack. James and I thought we [...]]]></description>
			<content:encoded><![CDATA[<p>I am happy to announce that the Seattle PowerShell Script Club will be meeting on <strong>Thursday, Nov 19th at </strong><a href="http://www.bing.com/maps/?v=2&amp;where1=818%20Stewart%20St%2C%20Seattle%2C%20WA%2098101-1306&amp;encType=1"><strong>818 Stewart St, Seattle WA</strong></a><strong> from 7:00 PM to 9:00 PM </strong>and a good chance of heading out for beers when we’re done.</p>
<p><a href="http://blogs.msdn.com/mediaandmicrocode/">James Brundage</a> has released his <a href="http://code.msdn.microsoft.com/PowerShellPack">Windows PowerShell Pack</a>. James and I thought we would start off with a couple examples of how to use WPK to create rich WPF based visualizations of data that is collected with PowerShell.&#160; From there, we can go pretty much anywhere you want to.</p>
<p>Please leave a comment if you plan on attending. <a href="https://www.clicktoattend.com/invitation.aspx?code=143135">Please Register Here</a></p>
<p>Hope to see you there!</p>
<p>Andy</p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/11/06/seattle-powershell-script-club-thurs-nov-19th/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Comparing Installed Hotfixes on Servers</title>
		<link>http://get-powershell.com/2009/08/28/comparing-installed-hotfixes-on-servers/</link>
		<comments>http://get-powershell.com/2009/08/28/comparing-installed-hotfixes-on-servers/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 14:21:19 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Compare-Object]]></category>
		<category><![CDATA[Hot Fix]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/08/28/comparing-installed-hotfixes-on-servers/</guid>
		<description><![CDATA[This week I had the need to scan several systems and see which hotfixes were installed on which machines and also figure out which hotfixes I needed to install to make sure all machines were identical. Now that PowerShell V2 has been RTM’d in windows 7 and is included in the Release Candidate of the [...]]]></description>
			<content:encoded><![CDATA[<p>This week I had the need to scan several systems and see which hotfixes were installed on which machines and also figure out which hotfixes I needed to install to make sure all machines were identical. Now that PowerShell V2 has been RTM’d in windows 7 and is included in the <a href="https://connect.microsoft.com/windowsmanagement/Downloads">Release Candidate of the Windows Management Framework,</a> I am going to go with V2 features. However, this script could be ported to V1 if need be. </p>
<p>As I was thinking about this problem, there were a few tools in the toolkit I thought I could use. The first is the new cmdlet, get-hotfix. This is just a wrapper of Win32_QuickFixEngineering but its nice to have it abstracted up to the cmdlet level. The second tool I thought of using is compare-object. I have known about this cmdlet but haven’t had a real opportunity to use it much. It’s actually very powerful but it does take a bit of neuron firing to wrap your head around how it works. </p>
<p>The way I set this is up allows me to compare two servers.&#160; I also have a credential parameter that is used to access servers so I can do my part in supporting the principle of <a href="http://technet.microsoft.com/en-us/library/bb456992.aspx">Least Privilege</a> and not be logged in with a Domain Admin account all the time. </p>
<p>So I pull the list of installed hotfixes from each server and select only the HotfixId property. This will make using the compare-object cmdlet a bit easier. If we do a get-member on compare-object we see that it outputs a PSObject with 2 noteproperties, a InputObject and a SideIndicator.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/08/image12.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/08/image_thumb10.png" width="466" height="284" /></a> </p>
<p>From the help on compare-object we find this description of the SideIndicator property:</p>
<p><em>The result of the comparison indicates whether a property value appeared only in the object from the Reference set (indicated by the &lt;= symbol), only in the object from the Difference set (indicated by the =&gt; symbol) or, if the IncludeEqual parameter is specified, in both objects (indicated by the == symbol).</em></p>
<p>Well that does the job but frankly its output is difficult to easily interpret at first glance. The beauty of PowerShell is that if you really don’t like the way something works, you can easily work around it. In this case, I created a new array of custom objects that have three properties: KB, the name of the first server, and the name of the second server. (Lines 19 and 22)</p>
<p>Then I foreach’d (the new verb of the day) through the collection of compared hotfixes and switched on the “SideIndicator” property. I did this to make the output more clear so users of the script would not have to interpret all the arrows and equal signs generated by compare-object.</p>
<p>Here is a sample of the output:</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/08/image13.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/08/image_thumb11.png" width="547" height="587" /></a> </p>
<p>I used Write-Host to generate some text output but I also get back an object that I can slice and dice later on.</p>
<div style="border-bottom: black 1px solid; border-left: black 1px solid; padding-bottom: 5px; padding-left: 5px; width: 750px; padding-right: 5px; font-family: consolas,lucida console; font-size: 10pt; overflow: auto; border-top: black 1px solid; border-right: black 1px solid; padding-top: 5px">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas,lucida console; background: #cecece; font-size: 10pt; padding-top: 5px">001             <br />002              <br />003              <br />004              <br />005              <br />006              <br />007              <br />008              <br />009              <br />010              <br />011              <br />012              <br />013              <br />014              <br />015              <br />016              <br />017              <br />018              <br />019              <br />020              <br />021              <br />022              <br />023              <br />024              <br />025              <br />026              <br />027              <br />028              <br />029              <br />030              <br />031              <br />032              <br />033              <br />034              <br />035              <br />036              <br />037              <br />038              <br />039              <br />040              <br />041              <br />042              <br />043              <br />044              <br />045              <br />046              <br />047              <br />048              <br />049              <br />050              </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas,lucida console; background: #fcfcfc; font-size: 10pt; padding-top: 5px"><span style="color: #00008b">Function</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">Compare-InstalledHotfix</span><span style="color: #000000">&#160;</span><span style="color: #000000">{</span>              <br /><span style="color: #00008b">param</span><span style="color: #000000">&#160;</span><span style="color: #000000">(</span>              <br /><span style="color: #a9a9a9">[</span><span style="color: #add8e6">parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #a9a9a9">,</span><span style="color: #000000">Position</span><span style="color: #a9a9a9">=</span><span style="color: #800080">0</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>              <br /><span style="color: #ff4500">$server1</span><span style="color: #a9a9a9">,</span>              </p>
<p><span style="color: #a9a9a9">[</span><span style="color: #add8e6">parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #a9a9a9">,</span><span style="color: #000000">Position</span><span style="color: #a9a9a9">=</span><span style="color: #800080">1</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>              <br /><span style="color: #ff4500">$server2</span><span style="color: #a9a9a9">,</span><span style="color: #000000">&#160;</span>              </p>
<p><span style="color: #a9a9a9">[</span><span style="color: #add8e6">parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #a9a9a9">,</span><span style="color: #000000">Position</span><span style="color: #a9a9a9">=</span><span style="color: #800080">3</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>              <br /><span style="color: #008080">[Management.Automation.PSCredential]</span>              <br /><span style="color: #ff4500">$credential</span>              <br /><span style="color: #000000">)</span>              </p>
<p><span style="color: #ff4500">$server1HotFix</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">get-hotfix</span><span style="color: #000000">&#160;</span><span style="color: #000080">-computer</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$server1</span><span style="color: #000000">&#160;</span><span style="color: #000080">-Credential</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$credential</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">|</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">select</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">HotfixId</span>              <br /><span style="color: #ff4500">$server2HotFix</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">get-hotfix</span><span style="color: #000000">&#160;</span><span style="color: #000080">-computer</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$server2</span><span style="color: #000000">&#160;</span><span style="color: #000080">-Credential</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$credential</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">|</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">select</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">HotfixId</span>              </p>
<p><span style="color: #ff4500">$comparedHotfixes</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">compare-object</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$server2HotFix</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$server1HotFix</span><span style="color: #000000">&#160;</span><span style="color: #000080">-IncludeEqual</span>              </p>
<p><span style="color: #ff4500">$result</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #000000">@(</span><span style="color: #000000">)</span><span style="color: #000000">;</span>              </p>
<p><span style="color: #00008b">foreach</span><span style="color: #000000">&#160;</span><span style="color: #000000">(</span><span style="color: #ff4500">$c</span><span style="color: #000000">&#160;</span><span style="color: #00008b">in</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$comparedHotfixes</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #000000">{</span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #8b0000">&quot;&quot;</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">|</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">select</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">KB</span><span style="color: #a9a9a9">,</span><span style="color: #ff4500">$server1</span><span style="color: #a9a9a9">,</span><span style="color: #ff4500">$server2</span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">KB</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$c</span><span style="color: #a9a9a9">.</span><span style="color: #000000">InputObject</span><span style="color: #a9a9a9">.</span><span style="color: #000000">HotfixId</span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #00008b">switch</span><span style="color: #000000">&#160;</span><span style="color: #000000">(</span><span style="color: #ff4500">$c</span><span style="color: #a9a9a9">.</span><span style="color: #000000">SideIndicator</span><span style="color: #000000">)</span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #000000">{</span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #8b0000">&quot;==&quot;</span><span style="color: #000000">&#160;</span><span style="color: #000000">{</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #0000ff">write-host</span><span style="color: #000000">&#160;</span><span style="color: #000080">-ForegroundColor</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">Green</span><span style="color: #000000">&#160;</span><span style="color: #8b0000">&quot;Both servers have $($c.InputObject.HotfixId)&quot;</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$server1</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$true</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$server2</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$true</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$result</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">+=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$kbinfo</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #000000">}</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #8b0000">&quot;=&gt;&quot;</span><span style="color: #000000">&#160;</span><span style="color: #000000">{</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #0000ff">write-host</span><span style="color: #000000">&#160;</span><span style="color: #000080">-ForegroundColor</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">Yellow</span><span style="color: #000000">&#160;</span><span style="color: #8b0000">&quot;$server1 has $($c.InputObject.HotfixId) but $server2 doesn&#8217;t&quot;</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$server1</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$true</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$server2</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$false</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$result</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">+=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$kbinfo</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #000000">}</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #8b0000">&quot;&lt;=&quot;</span><span style="color: #000000">&#160; </span><span style="color: #000000">{</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #0000ff">write-host</span><span style="color: #000000">&#160;</span><span style="color: #000080">-ForegroundColor</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">Magenta</span><span style="color: #000000">&#160;</span><span style="color: #8b0000">&quot;$server2 has $($c.InputObject.HotfixId) but $server1 doesn&#8217;t&quot;</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$server1</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$false</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$kbinfo</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$server2</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$true</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #ff4500">$result</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">+=</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$kbinfo</span>              <br /><span style="color: #000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #000000">}</span>              <br /><span style="color: #000000">&#160;&#160;&#160; </span><span style="color: #000000">}</span><span style="color: #000000">&#160;</span><span style="color: #006400"># End Switch</span>              <br /><span style="color: #000000">&#160; </span><span style="color: #000000">}</span><span style="color: #000000">&#160;</span><span style="color: #006400"># End foreach</span>              <br /><span style="color: #000000">&#160;&#160; </span><span style="color: #ff4500">$result</span>              <br /><span style="color: #000000">&#160;</span><span style="color: #000000">}</span><span style="color: #000000">&#160;</span><span style="color: #006400"># End Function</span>              </div>
</td>
</tr>
</tbody>
</table></div>
</p>
</p>
</p>
<p>This code is also available on the <a href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/b01c1fab-b16b-4784-9249-63d3488b70b7">TechNet Code Gallery</a> and up on <a href="http://poshcode.org/1296">PoshCode</a></p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/08/28/comparing-installed-hotfixes-on-servers/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Debugging using PowerShell ISE102</title>
		<link>http://get-powershell.com/2009/08/18/debugging-using-the-ise-102/</link>
		<comments>http://get-powershell.com/2009/08/18/debugging-using-the-ise-102/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 03:44:06 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[ISE]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/08/18/debugging-using-the-ise-102/</guid>
		<description><![CDATA[In my last post I gave a high level overview of how to get started with debugging in PowerShell 2.0, using the new Integrated Scripting Environment. In this installment, we are going to explore some of cmdlets that can be used to manipulate breakpoints. First,&#160; lets do some discovery. Whenever I am looking for cmdlets [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post I gave a high level overview of <a href="http://get-powershell.com/2009/08/14/debugging-using-powershell-ise-101/">how to get started with debugging in PowerShell 2.0, using the new Integrated Scripting Environment</a>. In this installment, we are going to explore some of cmdlets that can be used to manipulate breakpoints. </p>
<p>First,&#160; lets do some discovery. Whenever I am looking for cmdlets to work with something in particular, i use the get-command cmdlet with wildcards to help my search.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/08/image6.png"><img style="border-right-width: 0px; width: 700px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/08/image_thumb6.png" width="633" height="201" /></a> </p>
<p>So from this it looks like we can get, set, enable, disable, and remove breakpoints. When we are setting breakpoints, you can specify the line and column you want to break on, but that can get really tedious. This is what the ISE does for you automatically when you toggle breakpoints. However, I find it much more useful to break when ever a variable is accessed. </p>
<p>Let’s use a basic function to demonstrate this.We’ll create a function foo and then set a breakpoint for the $c variable.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/08/image7.png"><img style="border-right-width: 0px; width: 765px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/08/image_thumb7.png" width="631" height="167" /></a> </p>
</p>
<p>When we execute this code and call function foo, we get the output below. Notice that $a and $b is set, and that we break when we hit $c. One thing to note, when we specify the variable, we do not use the $ in front of the variable. This is the same as specifying the –outvariable common parameter for other cmdlets. </p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/08/image8.png"><img style="border-right-width: 0px; width: 639px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/08/image_thumb8.png" width="636" height="369" /></a> </p>
<p>Last but not least, let’s take a look at how to navigate this “nested” prompt. If you type “?” or “h”, you will get the following information It is interesting that the “nested&gt;” prompt displays this when you hit “?.” Under normal circumstances, the “?” is an alias for where-object, as we can see when we type ? at a normal prompt.</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/08/image10.png"><img style="border-right-width: 0px; width: 646px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/08/image_thumb9.png" width="637" height="367" /></a> </p>
</p>
<p>I hope this helps you with debugging your scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/08/18/debugging-using-the-ise-102/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PowerShell 2.0 for Vista and Server 2008</title>
		<link>http://get-powershell.com/2009/08/14/powershell-2-0-for-vista-and-server-2008/</link>
		<comments>http://get-powershell.com/2009/08/14/powershell-2-0-for-vista-and-server-2008/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 03:48:28 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Server 2008]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/08/14/powershell-2-0-for-vista-and-server-2008/</guid>
		<description><![CDATA[The release candidate for the Windows Management Framework is now available on the Microsoft Connect web site. The framework includes PowerShell 2.0, WinRM 2.0 and BITS 4.0. There are actually two downloads, one for PS and WinRM and another for Bits that make the whole framework. Download it here: https://connect.microsoft.com/windowsmanagement/Downloads]]></description>
			<content:encoded><![CDATA[<p>The release candidate for the Windows Management Framework is now available on the Microsoft Connect web site. The framework includes PowerShell 2.0, WinRM 2.0 and BITS 4.0. There are actually two downloads, one for PS and WinRM and another for Bits that make the whole framework.</p>
<p>Download it here:</p>
<p><a href="https://connect.microsoft.com/windowsmanagement/Downloads">https://connect.microsoft.com/windowsmanagement/Downloads</a></p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/08/14/powershell-2-0-for-vista-and-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seattle PowerShell Script Club #2  9/3/2009</title>
		<link>http://get-powershell.com/2009/08/12/seattle-powershell-script-club-2-932009/</link>
		<comments>http://get-powershell.com/2009/08/12/seattle-powershell-script-club-2-932009/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 20:25:03 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Script Club]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/08/12/seattle-powershell-script-club-2-932009/</guid>
		<description><![CDATA[I am happy to announce that Avanade will be hosting the second Seattle PowerShell Script Club on Thursday, September 3rd at 7:00 PM. You can register here. What is a PowerShell Script Club? Script Clubs are like a hands on lab with no set topic or teacher. You bring an idea for a script, and [...]]]></description>
			<content:encoded><![CDATA[<p>I am happy to announce that <a href="http://www.avanade.com">Avanade</a> will be hosting the second Seattle PowerShell Script Club on Thursday, September 3rd at 7:00 PM. You can register <a href="https://www.clicktoattend.com/register.aspx?eventid=140154">here</a>.</p>
<p>What is a PowerShell Script Club?</p>
<p>Script Clubs are like a hands on lab with no set topic or teacher. You bring an idea for a script, and ask your fellow PowerShell users for help getting the script written.</p>
<p><a href="http://blogs.msdn.com/mediaandmicrocode/">James Brundage</a>, from the PowerShell at team at Microsoft, will be joining us for the evening. </p>
<h3>About Seattle PowerShell Script Club</h3>
<p>1. You Always Talk About Script club    <br />2. You Always Talk About Script Club     <br />3. If Someone asks for Help, And You Can Help, You Help     <br />4. Two People Help One Person at One Time     <br />5. One Module Per Person Per Night     <br />6. All Scripts, All PowerShell     <br />7. Scripts will be as short as they can be     <br />8. If This is your First time at Script Club, You Have to Script</p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/08/12/seattle-powershell-script-club-2-932009/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Blend &#8211;&gt; XAML &#8211;&gt; PowerShell</title>
		<link>http://get-powershell.com/2009/05/19/blend-xaml-powershell/</link>
		<comments>http://get-powershell.com/2009/05/19/blend-xaml-powershell/#comments</comments>
		<pubDate>Tue, 19 May 2009 23:16:26 +0000</pubDate>
		<dc:creator>Andy Schneider</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://get-powershell.com/2009/05/19/blend-xaml-powershell/</guid>
		<description><![CDATA[The PowerShell team just posted a blog entry with slides and demo scripts for one of their presentations from TechEd 2009. There is a lot of cool stuff in their but one thing that piqued my interested was the GUI Demo using WPF. I noticed in the demo scripts that they had a PS1 script [...]]]></description>
			<content:encoded><![CDATA[<p>The PowerShell team just posted <a href="http://blogs.msdn.com/powershell/archive/2009/05/19/powershell-session-at-teched-2009.aspx">a blog entry</a> with slides and demo scripts for one of their presentations from TechEd 2009. There is a lot of cool stuff in their but one thing that piqued my interested was the GUI Demo using WPF. I noticed in the demo scripts that they had a PS1 script and a XAML file. I could try to describe XAML but I will leave that to the guys that literally wrote the book. </p>
<p>“XAML is an XML-based language for creating and initializing .NET objects. It’s used in WPF as a human-authorable way of describing the UI.” &#8211; “Programming WPF, by Chris Sells and Ian Griffiths, page 8</p>
<p><a href="http://www.microsoft.com/expression/products/overview.aspx?key=blend">Expression Blend</a> is a Microsoft product that allows designers to create UI’s in a sort of similar way that you could create WinForms using the WinForms designer in Visual Studio. It’s all drag ‘n drop. Blend is essentially a Winforms designer for WPF. It definitely takes some getting used to but the bottom line is that you don’t need to know how to code to get some basic windows, shapes, and controls up and running. </p>
<p>Here is a (not so) beautiful dialog box with a rectangle and a big button</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/05/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/05/image-thumb.png" width="475" height="361" /></a> </p>
<p>Well, in Blend, if you click on XAML tab you can see the angle brackets that make up this UI.</p>
<p>What’s cool is that you can use this XAML that was created with Blend in PowerShell.</p>
<p>We can accomplish this using a [Windows.Markup.XamlReader] and call that Load static Method. Assuming we store the XAML in a here string, you just need to cast it to XML and pass it in like so</p>
<p>$reader = New-Object System.Xml.XmlNodeReader $xaml   <br />$d = [Windows.Markup.XamlReader]::Load($reader)</p>
<p>Once you have $d you can do a bunch of things with it. </p>
<p>$d.ShowDialog() will display the dialog box as the script below demonstrates.</p>
<div style="border-bottom: black 1px solid; border-left: black 1px solid; padding-bottom: 5px; padding-left: 5px; width: 509px; padding-right: 5px; font-family: consolas,lucida console; height: 827px; font-size: 10pt; overflow: auto; border-top: black 1px solid; border-right: black 1px solid; padding-top: 5px">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas,lucida console; background: #cecece; font-size: 10pt; padding-top: 5px">001             <br />002              <br />003              <br />004              <br />005              <br />006              <br />007              <br />008              <br />009              <br />010              <br />011              <br />012              <br />013              <br />014              <br />015              <br />016              <br />017              <br />018              <br />019              <br />020              <br />021              <br />022              <br />023              <br />024              <br />025              <br />026              <br />027              <br />028              <br />029              <br />030              <br />031              <br />032              <br />033              <br />034              <br />035              <br />036              </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: consolas,lucida console; background: #fcfcfc; font-size: 10pt; padding-top: 5px"><span style="color: #008080">[xml]</span><span style="color: #ff4500">$xaml</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #8b0000">@&quot;               <br />&#160;&#160;&#160; &lt;Window                <br /> xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;                <br /> xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;                <br /> x:Name=&quot;Window&quot;                <br /> Title=&quot;Blend and PowerShell&quot;                <br /> Width=&quot;640&quot; Height=&quot;480&quot; AllowsTransparency=&quot;False&quot;&gt;                </p>
<p> &lt;Grid x:Name=&quot;LayoutRoot&quot;&gt;                <br />&#160; &lt;Button HorizontalAlignment=&quot;Right&quot;                 <br />&#160;&#160;&#160; Margin=&quot;0,0,153,194&quot;                 <br />&#160;&#160;&#160; VerticalAlignment=&quot;Bottom&quot;                 <br />&#160;&#160;&#160; Width=&quot;5&quot; Height=&quot;2&quot;                 <br />&#160;&#160;&#160; Content=&quot;Button&quot;/&gt;                <br />&#160; &lt;Rectangle Margin=&quot;22,8,22,0&quot;                 <br />&#160;&#160;&#160;&#160;&#160;&#160; VerticalAlignment=&quot;Top&quot;                 <br />&#160;&#160;&#160;&#160;&#160;&#160; Height=&quot;178&quot;                 <br />&#160;&#160;&#160;&#160;&#160;&#160; Stroke=&quot;#FF000000&quot;&gt;                <br />&#160;&#160; &lt;Rectangle.Fill&gt;                <br />&#160;&#160;&#160; &lt;LinearGradientBrush EndPoint=&quot;0.5,1&quot; StartPoint=&quot;0.5,0&quot;&gt;                <br />&#160;&#160;&#160;&#160; &lt;GradientStop Color=&quot;#FF000000&quot; Offset=&quot;0&quot;/&gt;                <br />&#160;&#160;&#160;&#160; &lt;GradientStop Color=&quot;#FF861A1A&quot; Offset=&quot;1&quot;/&gt;                <br />&#160;&#160;&#160; &lt;/LinearGradientBrush&gt;                <br />&#160;&#160; &lt;/Rectangle.Fill&gt;                <br />&#160; &lt;/Rectangle&gt;                <br />&#160; &lt;Button Margin=&quot;121,0,129,96&quot;                 <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; VerticalAlignment=&quot;Bottom&quot;                 <br />&#160;&#160;&#160; Height=&quot;100&quot;                 <br />&#160;&#160;&#160; Content=&quot;Button&quot;                 <br />&#160;&#160;&#160; x:Name=&quot;Close&quot;/&gt;                <br /> &lt;/Grid&gt;                <br />&lt;/Window&gt;                <br />&quot;@</span>              <br /><span style="color: #ff4500">$reader</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">New-Object</span><span style="color: #000000">&#160;</span><span style="color: #8a2be2">System.Xml.XmlNodeReader</span><span style="color: #000000">&#160;</span><span style="color: #ff4500">$xaml</span>              <br /><span style="color: #ff4500">$d</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">=</span><span style="color: #000000">&#160;</span><span style="color: #008080">[Windows.Markup.XamlReader]</span><span style="color: #a9a9a9">::</span><span style="color: #000000">Load</span><span style="color: #000000">(</span><span style="color: #ff4500">$reader</span><span style="color: #000000">)</span>              <br /><span style="color: #ff4500">$d</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ShowDialog</span><span style="color: #000000">(</span><span style="color: #000000">)</span><span style="color: #000000">&#160;</span><span style="color: #a9a9a9">|</span><span style="color: #000000">&#160;</span><span style="color: #0000ff">out-null</span> </div>
</td>
</tr>
</tbody>
</table></div>
</p>
</p>
<p>When I run this, I get the following</p>
<p><a href="http://get-powershell.com/wp-content/uploads/2009/05/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://get-powershell.com/wp-content/uploads/2009/05/image-thumb1.png" width="531" height="404" /></a> </p>
<p>You may notice I tweaked the XAML a little bit. I changed the Window title on line 6. Blend also adds a class to its &lt;Window&gt; tag that is associated with the project in Blend. I had to remove that to get it to work in PowerShell. Other than that, we basically have a WPF editor that can create XAML that can be used in PowerShell. </p>
<p>My next post will deal with events. I do suppose it would be nice if clicking the button actually did something, huh.</p>
<p>Until next time..</p>
<p>Andy</p>
]]></content:encoded>
			<wfw:commentRss>http://get-powershell.com/2009/05/19/blend-xaml-powershell/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
