<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Brad Rutkowski's Blog : Powershell</title><link>http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx</link><description>Tags: Powershell</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Interacting with Data Collector Sets via Powershell</title><link>http://blogs.technet.com/brad_rutkowski/archive/2009/02/18/interacting-with-data-collector-sets-via-powershell.aspx</link><pubDate>Thu, 19 Feb 2009 00:30:12 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3204255</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3204255.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3204255</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;&lt;u&gt;Background:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In an &lt;a href="http://blogs.technet.com/brad_rutkowski/archive/2007/04/14/hey-admins-let-s-explore-vista-together-part-1.aspx" target="_blank"&gt;earlier post&lt;/a&gt; I talked about some new features for Windows 2008 and Vista.&amp;#160; One of those new features that is often overlooked are the data collector sets (DCS).&amp;#160; One particular role that leverages data collector sets is active directory.&amp;#160; Active directory has put “hooks” into tracing that can really take a lot of the thinking out of the question “why is my domain controller sluggish”.&amp;#160; For those of you still running Windows 2003 I go over a similar concept called &lt;a href="http://blogs.technet.com/brad_rutkowski/archive/2007/06/26/great-tool-for-windows-2003-server-performance-advisor-spa.aspx" target="_blank"&gt;Server Performance Advisor&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;Anyways, you can play around with DCS by typing perfmon and then traversing to the section called Data Collector Sets (shocking).&amp;#160; If you have performance issues, go here first as it’s like combining a netmon capture with a kernel trace and then handing you the smoking gun.&amp;#160; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img src="http://i149.photobucket.com/albums/s62/brad9987/Capture-3.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Challenge:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In my current role, we have a need to automate things quite a bit and so one of the actions I was looking at solving was collecting diagnostic information when a server is performing poorly.&amp;#160; Usually when a high CPU alert comes in, someone would need to logon to the server and go to perfmon and start at DCS collection.&amp;#160; More often is the case that by the time someone had been alerted and went to the server the sluggish behavior had subsided (the dreaded “close ticket, no problem found”).&lt;/p&gt;  &lt;p&gt;My solution was to try and figure out a way to start a DCS collection remotely at the time of event so that the data was present when an actual human became engaged.&lt;/p&gt;  &lt;p&gt;After some hard work, here is the code to do so!&amp;#160; You can create your own XML file (your own DCS template) and pass it in, but more than likely you’ll be happy at just kicking off one of the built-in templates (AD/System Perf/System Diags).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Running it via powershell:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;First, how to do it on the fly:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #008000"&gt;## PLA.dll lives under system32 on Vista and 2k8.  This will create a powershell com object.&lt;/span&gt;
$datacollectorset = new-object -COM Pla.DataCollectorSet
&lt;span style="color: #008000"&gt;##This is the name of the predefined DCS collector.  It's read-only and will always be System\&amp;lt;something&amp;gt;&lt;/span&gt;
$name = &lt;span style="color: #006080"&gt;&amp;quot;System\Active Directory Diagnostics&amp;quot;&lt;/span&gt;
&lt;span style="color: #008000"&gt;##If you make the second param $null it will be the local machine.&lt;/span&gt;
$datacollectorset.Query($name,&lt;span style="color: #006080"&gt;&amp;quot;serverA&amp;quot;&lt;/span&gt;) 
$datacollectorset.start($false)
&lt;span style="color: #008000"&gt;## Status ReturnCodes: 0=stopped 1=running 2=compiling 3=queued (legacy OS) 4=unknown (usually autologger)&lt;/span&gt;
$datacollectorset.status
&lt;span style="color: #008000"&gt;##When you're ready to stop it call stop.&lt;/span&gt;
$datacollectorset.stop($false)
&lt;span style="color: #008000"&gt;##If you call status here, it will probably be '2' for a while as the server compiles the report.&lt;/span&gt;
$datacollectorset.status&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;And like so, you started and stopped a collection for Active Directory on you’re local computer or a remote server!&amp;#160; Like I said though, you can create you’re own templates too.&amp;#160; You might want to do this if you want to setup a built-in template to be scheduled to run daily, or perhaps you want to send the data to a network location, run more tasks at completion, etc.&amp;#160; If you do want to create a custom template then the code changes a bit:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;$datacollectorset = new-object -COM Pla.DataCollectorSet
&lt;span style="color: #008000"&gt;## If you're making you're own (shows up under user defined).  &lt;/span&gt;
$xml = get-content C:\custom.xml &lt;span style="color: #008000"&gt;#You're custom exported XML file.&lt;/span&gt;
$datacollectorset.SetXml($xml)
&lt;span style="color: #008000"&gt;##Commit codes: http://msdn.microsoft.com/en-us/library/aa371873(VS.85).aspx this is add or modify.  Can't do this on a system created PLA instances (read only).&lt;/span&gt;
$datacollectorset.Commit($DCSPath , $null , 0x0003)     
$datacollectorset.Query($DCSPath,$null)
$datacollectorset.start($false)
&lt;span style="color: #008000"&gt;#Runs...&lt;/span&gt;
$datacollectorset.stop($false)&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Scripting a solution:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally if you wanted to script this you could do something like what I’ve done below.&amp;#160; This would collect for a desired interval (in seconds) and then when compilation completed display the path to the report.&amp;#160; I wrote this in CTP3, but you can easily take the concepts and backport them.&amp;#160; If the destination server is inaccessible, or you don't have permissions, then the script will blow up…&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;lt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;
    .SYNOPSIS
    This will fire up a PLA (Data Collector Set collection on a server and then copy it to the proper debug server
 
    .DESCRIPTION
    This is a proof of concept and only acceppts System defined collections.  No error handling so I hope you type well.

&lt;span style="color: #008000"&gt;#&amp;gt;&lt;/span&gt;

&lt;span style="color: #008000"&gt;##Inputs&lt;/span&gt;
[CmdletBinding()]
&lt;span style="color: #0000ff"&gt;param&lt;/span&gt;(
   [Parameter(Mandatory = $true)]
   &amp;lt;&lt;span style="color: #008000"&gt;#A system provided report to run like &amp;quot;System\System Performance&amp;quot;, System\System Diagnostics, etc. #&amp;gt;&lt;/span&gt;
   [string]$DCSPath,
   [Parameter(Mandatory = $true)]
   &amp;lt;&lt;span style="color: #008000"&gt;# This is how long you want the DCS collection to run in seconds#&amp;gt;&lt;/span&gt;
   [int32]$time,
   [Parameter(Mandatory = $false)]
   &amp;lt;&lt;span style="color: #008000"&gt;#If you don't pass in a server name it will be $null and run on the local system#&amp;gt;&lt;/span&gt;
   [string]$serverName
    )

    $datacollectorset = new-object -COM Pla.DataCollectorSet  
    $datacollectorset.Query($DCSPath,$serverName)
    $datacollectorset.start($false)
    Start-Sleep $time
    $datacollectorset.stop($false)
    
    &lt;span style="color: #008000"&gt;##Now we'll loop while the report compiles.&lt;/span&gt;
    $retries = 0
    do 
        {sleep 30; $returnCode = $datacollectorset.Status ; $retries++} 
    &lt;span style="color: #0000ff"&gt;while&lt;/span&gt; ($returnCode &lt;span style="color: #cc6633"&gt;-eq&lt;/span&gt; 2 -and $retries &lt;span style="color: #cc6633"&gt;-lt&lt;/span&gt; 60)
    
    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($retries &lt;span style="color: #cc6633"&gt;-eq&lt;/span&gt; 60)
    {
        Write-Warning &lt;span style="color: #006080"&gt;&amp;quot;Compiling has been running on the server for 30 minutes!  You'll need to check the following location on the server later for the report:&amp;quot;&lt;/span&gt;
        Write-Warning $datacollectorset.OutputLocation
        &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;
    }
    
    &lt;span style="color: #008000"&gt;##Compiling has finished, now we can copy the folder to some location&lt;/span&gt;
    $path = $datacollectorset.OutputLocation
    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($serverName)
    {
    $path = $path.Replace(&lt;span style="color: #006080"&gt;&amp;quot;:&amp;quot;&lt;/span&gt;,&lt;span style="color: #006080"&gt;&amp;quot;$&amp;quot;&lt;/span&gt;)
    Write-Host &lt;span style="color: #006080"&gt;&amp;quot;`nReport complete and can be viewed at \\$serverName\$path\report.html on the server.`n&amp;quot;&lt;/span&gt; 
    }
    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;
    {
    Write-Host &lt;span style="color: #006080"&gt;&amp;quot;`nReport complete and can be viewed at $path\report.html`n&amp;quot;&lt;/span&gt;
    }
    
   &lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;The result:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://i149.photobucket.com/albums/s62/brad9987/Capture-4.jpg" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;More info:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PLA reference: &lt;a title="http://msdn.microsoft.com/en-us/library/aa372634(VS.85).aspx" href="http://msdn.microsoft.com/en-us/library/aa372634(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa372634(VS.85).aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:13243a34-9c35-4042-b4eb-9f0961bae121" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Powershell" rel="tag"&gt;Powershell&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Windows+2008" rel="tag"&gt;Windows 2008&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Active+Directory" rel="tag"&gt;Active Directory&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Windows" rel="tag"&gt;Windows&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3204255" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Business+up+front/default.aspx">Business up front</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/DS/default.aspx">DS</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Metrics/default.aspx">Metrics</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Windows+Server+2008/default.aspx">Windows Server 2008</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Cool+Tools/default.aspx">Cool Tools</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Check that driver file versions match on all your cluster nodes via Powershell</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/12/03/check-that-driver-file-versions-match-on-all-your-cluster-nodes-match-via-powershell.aspx</link><pubDate>Thu, 04 Dec 2008 02:25:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3163587</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3163587.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3163587</wfw:commentRss><description>&lt;P&gt;&lt;BR&gt;This is more of a proof of concept, but I've used it with success internally.&amp;nbsp; Take it and do with it what you want.&amp;nbsp; Many thx to &lt;A href="http://bsonposh.com/" target=_blank mce_href="http://bsonposh.com/"&gt;Brandon&lt;/A&gt; who did the "heavy lifting" when I got stuck!&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Overview:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Ever run into cluster issues and wanted to see if the driver file versions matched on all the nodes of the cluster to rule out a mismatch on a driver level?&amp;nbsp; Well I did!&amp;nbsp; The basic gist is that you can show all the file versions for each node by just running the script against a node name.&amp;nbsp; If you want to see only the drivers that don’t match then you’d use the pipeline with where-object (?).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Typical output:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;When All drivers match: &lt;BR&gt;&lt;/EM&gt;PS C:\Debuggers&amp;gt; Test-MSCluster.ps1 ServerSQL11 | ?{!$_.IsSame} &lt;BR&gt;Getting Nodes via WMI &lt;BR&gt;Getting the drivers on: ServerSQL11 &lt;BR&gt;Getting the file versions for the drivers on: ServerSQL11 &lt;BR&gt;Getting the drivers on: ServerSQL12 &lt;BR&gt;Getting the file versions for the drivers on: ServerSQL12 &lt;BR&gt;PS C:\Debuggers&amp;gt; &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;One Mismatch: &lt;BR&gt;&lt;/EM&gt;PS C:\Debuggers&amp;gt; Test-MSCluster.ps1 ServerAX | ?{!$_.IsSame} &lt;BR&gt;Getting Nodes via WMI &lt;BR&gt;Getting the drivers on: ServerAX &lt;BR&gt;Getting the file versions for the drivers on: ServerAX &lt;BR&gt;Getting the drivers on: ServerBX &lt;BR&gt;Getting the file versions for the drivers on: ServerBX &lt;/P&gt;
&lt;P&gt;FileName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerAX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerBX &lt;BR&gt;--------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------- &lt;BR&gt;rmcast.sys&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6.0.6001.18000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6.0.6001.18069&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;EM&gt;Many nodes, many mismatches:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;PS C:\Debuggers&amp;gt; Test-MSCluster.ps1 Server-Clus--11 | ?{!$_.IsSame}&amp;nbsp; &lt;BR&gt;Getting Nodes via WMI &lt;BR&gt;Getting the drivers on: Server-Clus--10 &lt;BR&gt;Getting the file versions for the drivers on: Server-Clus--10 &lt;BR&gt;Getting the drivers on: Server-Clus--11 &lt;BR&gt;Getting the file versions for the drivers on: Server-Clus--11 &lt;BR&gt;Getting the drivers on: Server-Clus--15 &lt;BR&gt;Getting the file versions for the drivers on: Server-Clus--15 &lt;BR&gt;Getting the drivers on: Server-Clus--16 &lt;BR&gt;Getting the file versions for the drivers on: Server-Clus--16 &lt;BR&gt;Getting the drivers on: Server-Clus--13 &lt;BR&gt;Getting the file versions for the drivers on: Server-Clus--13 &lt;BR&gt;Getting the drivers on: Server-Clus--12 &lt;BR&gt;Getting the file versions for the drivers on: Server-Clus--12 &lt;/P&gt;
&lt;P&gt;FileName&amp;nbsp;&amp;nbsp; : Dbgv.sys &lt;BR&gt;Server-Clus--10 : 4.60 &lt;BR&gt;Server-Clus--11 : FileMissing &lt;BR&gt;Server-Clus--15 : FileMissing &lt;BR&gt;Server-Clus--16 : FileMissing &lt;BR&gt;Server-Clus--13 : FileMissing &lt;BR&gt;Server-Clus--12 : FileMissing &lt;BR&gt;IsSame&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False &lt;/P&gt;
&lt;P&gt;FileName&amp;nbsp;&amp;nbsp; : HpCISSs2.sys &lt;BR&gt;Server-Clus--10 : FileMissing &lt;BR&gt;Server-Clus--11 : FileMissing &lt;BR&gt;Server-Clus--15 : FileMissing &lt;BR&gt;Server-Clus--16 : 6.8.0.64 Build 9 (x86-64) &lt;BR&gt;Server-Clus--13 : 6.8.0.64 Build 9 (x86-64) &lt;BR&gt;Server-Clus--12 : 6.8.0.64 Build 9 (x86-64) &lt;BR&gt;IsSame&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False &lt;/P&gt;
&lt;P&gt;FileName&amp;nbsp;&amp;nbsp; : USBSTOR.SYS &lt;BR&gt;Server-Clus--10 : FileMissing &lt;BR&gt;Server-Clus--11 : FileMissing &lt;BR&gt;Server-Clus--15 : FileMissing &lt;BR&gt;Server-Clus--16 : FileMissing &lt;BR&gt;Server-Clus--13 : 6.0.6001.18000 &lt;BR&gt;Server-Clus--12 : 6.0.6001.18000 &lt;BR&gt;IsSame&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False &lt;/P&gt;
&lt;P&gt;FileName&amp;nbsp;&amp;nbsp; : mrxsmb10.sys &lt;BR&gt;Server-Clus--10 : 6.0.6001.18000 &lt;BR&gt;Server-Clus--11 : 6.0.6001.18000 &lt;BR&gt;Server-Clus--15 : 6.0.6001.18000 &lt;BR&gt;Server-Clus--16 : 6.0.6001.18068 &lt;BR&gt;Server-Clus--13 : 6.0.6001.18000 &lt;BR&gt;Server-Clus--12 : 6.0.6001.18000 &lt;BR&gt;IsSame&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False &lt;/P&gt;
&lt;P&gt;FileName&amp;nbsp;&amp;nbsp; : nm3.sys &lt;BR&gt;Server-Clus--10 : 03.02.0764.0001 &lt;BR&gt;Server-Clus--11 : FileMissing &lt;BR&gt;Server-Clus--15 : FileMissing &lt;BR&gt;Server-Clus--16 : FileMissing &lt;BR&gt;Server-Clus--13 : FileMissing &lt;BR&gt;Server-Clus--12 : FileMissing &lt;BR&gt;IsSame&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False&lt;/P&gt;
&lt;DIV class=code&gt;Code:&lt;/DIV&gt;
&lt;DIV class=code&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=code&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #008000"&gt;######################################################################&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #008000"&gt;#Test-MSCluster.ps1&lt;/SPAN&gt;
Param($ClusterNode)

&lt;SPAN style="COLOR: #008000"&gt;# I am using this hashtable to store a unique list of file names. &lt;/SPAN&gt;
$Files = @{}
&lt;SPAN style="COLOR: #008000"&gt;# I am using this array to store my custom objects we create later.&lt;/SPAN&gt;
$FileObjects = @()

Write-Host &lt;SPAN style="COLOR: #006080"&gt;"Getting Nodes via WMI"&lt;/SPAN&gt;
$nodes = gwmi -q &lt;SPAN style="COLOR: #006080"&gt;"Select name from MSCluster_Node"&lt;/SPAN&gt; -namespace root\mscluster -computername $ClusterNode -Authentication PacketPrivacy | %{$_.Name}

&lt;SPAN style="COLOR: #008000"&gt;# Here we process each node and get all the drivers from the node and add it to our $Files HashTable to be processed&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt; ( $node &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $nodes )
{
    Write-Host &lt;SPAN style="COLOR: #006080"&gt;"Getting the drivers on:"&lt;/SPAN&gt;  $node
    &lt;SPAN style="COLOR: #008000"&gt;# Here we are getting a list of the .sys files. Notice I am only getting the names&lt;/SPAN&gt;
    $filelistFinal = get-childitem &lt;SPAN style="COLOR: #006080"&gt;"\\$node\admin$\system32\drivers"&lt;/SPAN&gt; *.sys | %{$_.name}
    
    Write-Host &lt;SPAN style="COLOR: #006080"&gt;"Getting the file versions for the drivers on:"&lt;/SPAN&gt; $node
    &lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt;($file &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $filelistFinal)
    {
        &lt;SPAN style="COLOR: #008000"&gt;# foreach file found we add it to the hasttable, but hashtables can only have a key once&lt;/SPAN&gt;
        &lt;SPAN style="COLOR: #008000"&gt;# so we need check if the key already exist. I do this because it is possible you could have&lt;/SPAN&gt;
        &lt;SPAN style="COLOR: #008000"&gt;# unique drivers per node.&lt;/SPAN&gt;
        &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;(!$Files.$file)
        {
            $Files.Add($file,&lt;SPAN style="COLOR: #006080"&gt;"added"&lt;/SPAN&gt;)
        }
    }
}

&lt;SPAN style="COLOR: #008000"&gt;# Ok... now we have all our files time to process the hashtable and create our custom objects&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt;($FileName &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $Files.Keys)
{
    &lt;SPAN style="COLOR: #008000"&gt;# This is how I create an object for each file&lt;/SPAN&gt;
    $myFileObj = New-Object System.Object
    
    &lt;SPAN style="COLOR: #008000"&gt;# This is how we add a property. In this case the FileName property. For these scenarios I chose add-member&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #008000"&gt;# because you can dynamically add properties (i.e. NodeName with value of File version)&lt;/SPAN&gt;
    $myFileobj | add-Member -MemberType NoteProperty -Name FileName -Value $FileName
    
    &lt;SPAN style="COLOR: #008000"&gt;# Now we need to add properties for each node.&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt;($node &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $nodes)
    {
        &lt;SPAN style="COLOR: #008000"&gt;# Making sure the file exist on the node&lt;/SPAN&gt;
        &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;(Test-Path \\$node\admin$\system32\drivers\$FileName)
        {
            &lt;SPAN style="COLOR: #008000"&gt;# Getting ProductVersion Info to use as the value for the Node Property&lt;/SPAN&gt;
            $fileInfo = [system.diagnostics.fileversioninfo]::getversioninfo(&lt;SPAN style="COLOR: #006080"&gt;"\\$node\admin$\system32\drivers\$FileName"&lt;/SPAN&gt;)
            $myFileobj | add-Member -MemberType NoteProperty -Name $node -Value $FileInfo.ProductVersion
        }
        &lt;SPAN style="COLOR: #0000ff"&gt;else&lt;/SPAN&gt;
        {
            &lt;SPAN style="COLOR: #008000"&gt;# File not found using FileMissing as the value for the Node Property&lt;/SPAN&gt;
            $myFileobj | add-Member -MemberType NoteProperty -Name $node -Value &lt;SPAN style="COLOR: #006080"&gt;"FileMissing"&lt;/SPAN&gt;
        }
    }
    &lt;SPAN style="COLOR: #008000"&gt;# Outputting Object&lt;/SPAN&gt;
    $FileObjects += $myFileObj
}

&lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt;($result &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $FileObjects)
{
    $isSame = $true
    &lt;SPAN style="COLOR: #008000"&gt;# Getting Server Name from Properties of the custom object&lt;/SPAN&gt;
    $servers = $result | Get-Member -MemberType Noteproperty | ?{$_.Name &lt;SPAN style="COLOR: #cc6633"&gt;-ne&lt;/SPAN&gt; &lt;SPAN style="COLOR: #006080"&gt;"FileName"&lt;/SPAN&gt;} | %{$_.Name}
    
    &lt;SPAN style="COLOR: #008000"&gt;# Checking the value of each server vs the other servers&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt;($server &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $servers)
    {
        &lt;SPAN style="COLOR: #0000ff"&gt;foreach&lt;/SPAN&gt;($srv &lt;SPAN style="COLOR: #0000ff"&gt;in&lt;/SPAN&gt; $servers)
        {
            &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;($srv &lt;SPAN style="COLOR: #cc6633"&gt;-ne&lt;/SPAN&gt; $server)
            {
                &lt;SPAN style="COLOR: #008000"&gt;# If the the value is different we set $isSame to $false&lt;/SPAN&gt;
                &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt;($result.&lt;SPAN style="COLOR: #006080"&gt;"$srv"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #cc6633"&gt;-ne&lt;/SPAN&gt; $result.&lt;SPAN style="COLOR: #006080"&gt;"$server"&lt;/SPAN&gt;){$isSame = $false}
            }
        }
    }
    &lt;SPAN style="COLOR: #008000"&gt;# add the isSame property to the object&lt;/SPAN&gt;
    $result | add-Member -MemberType NoteProperty -Name IsSame -value $isSame
    
    &lt;SPAN style="COLOR: #008000"&gt;# output object&lt;/SPAN&gt;
    $result 
}
&lt;SPAN style="COLOR: #008000"&gt;######################################################################&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;***Note:&amp;nbsp; This script is not fast, as it is getting the file versions for every driver (*.sys)&amp;nbsp; on each system,&amp;nbsp; I'd highly suggest not running this over the WAN...&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3163587" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Business+up+front/default.aspx">Business up front</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Ghetto+scripting/default.aspx">Ghetto scripting</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>SET-ACL on registry key</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/09/29/set-acl-on-registry-key.aspx</link><pubDate>Mon, 29 Sep 2008 18:06:49 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3129967</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3129967.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3129967</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Man it was hard to find info on using set-acl on a registry key!&amp;#160;&amp;#160; I was looking for a way to set an ACL that once set would be inherited by child keys and values.&amp;#160;&amp;#160;&amp;#160; We needed to give “Local Service” full control on the registry key below and have the subkeys inherit the permission.&amp;#160; You might say:&amp;#160; “Why not use SUBINACL?”, well due to a bug or by design SUBINACL doesn’t work for WIN7 server core (probably should look into that).&amp;#160; Besides, why call an exe when you can do it natively in PS.&amp;#160; Anyways here is the code that ended up working.&amp;#160; Hope next time someone goes looking for this it’ll be the first hit.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; $acl= get-acl -path &amp;quot;hklm:\SOFTWARE\Microsoft\Reliability Analysis&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; $inherit = [system.security.accesscontrol.InheritanceFlags]&amp;quot;ContainerInherit, ObjectInherit&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; $propagation = [system.security.accesscontrol.PropagationFlags]&amp;quot;None&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; $rule=new-object system.security.accesscontrol.registryaccessrule &amp;quot;LOCAL SERVICE&amp;quot;,&amp;quot;FullControl&amp;quot;,$inherit,$propagation,&amp;quot;Allow&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; $acl.addaccessrule($rule)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; $acl|set-acl&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;&lt;strong&gt;&lt;em&gt;And the output of GET-ACL shows local service now:&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;PS C:\&amp;gt; get-acl -path &amp;quot;hklm:\SOFTWARE\Microsoft\Reliability Analysis&amp;quot; | fl &lt;font color="#ff0000"&gt;&amp;lt;—Verifying that it got set.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;Path&amp;#160;&amp;#160; : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Reliability Analysis&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;Owner&amp;#160; : BUILTIN\Administrators&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;Group&amp;#160; : DOMAIN\Domain Users&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&lt;strong&gt;Access : NT AUTHORITY\LOCAL SERVICE Allow&amp;#160; FullControl&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BUILTIN\Users Allow&amp;#160; ReadKey&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BUILTIN\Users Allow&amp;#160; -2147483648&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BUILTIN\Administrators Allow&amp;#160; FullControl&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BUILTIN\Administrators Allow&amp;#160; 268435456&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NT AUTHORITY\SYSTEM Allow&amp;#160; FullControl&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NT AUTHORITY\SYSTEM Allow&amp;#160; 268435456&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CREATOR OWNER Allow&amp;#160; 268435456&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;Audit&amp;#160; :&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="cour" size="1"&gt;Sddl&amp;#160;&amp;#160; : O:BAG:DUD:AI(A;OICI;KA;;;LS)(A;ID;KR;;;BU)(A;CIIOID;GR;;;BU)(A;ID;KA;;;BA)(A;CIIOID;GA;;;BA)(A;ID;KA;;;SY)(A;CIIOID;GA;;;SY)(A;CIIOID;GA;;;CO)&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3129967" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Business+up+front/default.aspx">Business up front</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Ghetto+scripting/default.aspx">Ghetto scripting</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Caught the Powershell Bug.</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/09/26/caught-the-powershell-bug.aspx</link><pubDate>Fri, 26 Sep 2008 23:35:43 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3129173</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3129173.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3129173</wfw:commentRss><description>&lt;p&gt;Over the past few months I have fallen in love with PowerShell.&amp;#160;&amp;#160; I’ve taken on a new role (starting in mid-October) that will be more focused on automating out administrative tasks via powershell so the focus of this blog might change more towards that subject.&amp;#160; I think the crowd that congregates here are IT admins for the most part, so this should remain relevant to your jobs (did this blog have a focus anyways?). If you have a scripting question, drop me a mail and I’ll post about it later.&lt;/p&gt;  &lt;p&gt;This is where I started, its a self paced course on the basics.&amp;#160; Once you walk through this (2 hours) you’ll start seeing the power: &lt;a title="http://download.microsoft.com/download/4/7/1/47104ec6-410d-4492-890b-2a34900c9df2/Workshops-EN.zip" href="http://download.microsoft.com/download/4/7/1/47104ec6-410d-4492-890b-2a34900c9df2/Workshops-EN.zip"&gt;http://download.microsoft.com/download/4/7/1/47104ec6-410d-4492-890b-2a34900c9df2/Workshops-EN.zip&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Obligatory powershell jpg:&lt;/p&gt;  &lt;p&gt;&lt;img height="220" src="http://static.flickr.com/164/421721170_646066ae87.jpg" width="281" /&gt;&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3129173" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Party+in+the+back/default.aspx">Party in the back</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Using invoke-command to launch a script on a remote computer which connects to network resources.</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/09/26/using-invoke-command-to-launch-a-script-on-a-remote-computer-which-connects-to-network-resources.aspx</link><pubDate>Fri, 26 Sep 2008 22:19:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3129131</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3129131.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3129131</wfw:commentRss><description>&lt;P&gt;First, I found the details &lt;A href="http://blogs.msdn.com/powershell/archive/2008/06/05/credssp-for-second-hop-remoting-part-i-domain-account.aspx" target=_blank mce_href="http://blogs.msdn.com/powershell/archive/2008/06/05/credssp-for-second-hop-remoting-part-i-domain-account.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Second, things can change as this is being done with the CTP for Powershell 2.0&lt;/P&gt;
&lt;P&gt;Third, if you don’t know about remoting in 2.0 watch &lt;A href="http://edge.technet.com/Media/Remote-Management-A-Sneak-Peek-at-Windows-PowerShell-20/" target=_blank mce_href="http://edge.technet.com/Media/Remote-Management-A-Sneak-Peek-at-Windows-PowerShell-20/"&gt;this 5 minute video&lt;/A&gt;. Then read &lt;A href="http://technet.microsoft.com/en-us/magazine/cc718988.aspx?pr=blog" target=_blank mce_href="http://technet.microsoft.com/en-us/magazine/cc718988.aspx?pr=blog"&gt;this&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Whew.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&lt;U&gt;Backstory:&lt;/U&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;You might find yourself in a situation where you want to run a batch/vbs/cmd file on a bunch of servers at once. This batch file requires to connect to network locations to gather/put information during run time. The Powershell 2.0 remoting experience out of the box doesn’t allow you to do these “double hops” with the client side credentials. What happens is that when you remote using powershell, you get a set of credentials for use on that machine.&amp;nbsp; When you go off-box, the request hasthe machine credentials. This obviously can cause issues leaving you two solutions:&lt;/P&gt;
&lt;P&gt;1) Change the ACLS on the remote share to include the machine credentials&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;a. Can be done by adding &amp;lt;domain&amp;gt;\domain computers with read access to the shares(s).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;b. Create a group that has all the machines required in it and ACL out the share permissions with that group.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;2) Use CredSSP so that you get a credential which can do multi-hop.&lt;/P&gt;
&lt;P&gt;So what is required to use CredSSP, thus allowing your client-side credentials to “pass-thru” to the server-side and go off box as your creds?&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&lt;U&gt;On the client-side:&lt;/U&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;new-item HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -force &lt;BR&gt;new-ItemProperty HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -name AllowFreshCredentials -value 1 -type DWord -force &lt;BR&gt;new-ItemProperty HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -name ConcatenateDefaults_AllowFresh -value 1 -type DWord -force &lt;BR&gt;new-item HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentials -force &lt;BR&gt;new-ItemProperty HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentials -name 1 -value wsman/* -force &lt;BR&gt;winrm s winrm/config/client/auth '@{CredSSP="true"}'&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&lt;BR&gt;On the server-side:&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;winrm s winrm/config/service/auth &lt;A href="mailto:'@%7BCredSSP=%22true%22%7D'" mce_href="mailto:'@{CredSSP=&amp;quot;true&amp;quot;}'"&gt;'@{CredSSP="true"}'&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;&lt;U&gt;Example without credSSP:&lt;/U&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;PS C:\Debuggers&amp;gt; Invoke-Command -ComputerName server1.domain.com,server2.domain.com -ScriptBlock {c:\debuggers\test_PS.cmd} -Credential reddom\brad&lt;/P&gt;
&lt;P&gt;C:\Windows\System32&amp;gt;cd\ &lt;/P&gt;
&lt;P&gt;C:\&amp;gt;cd debuggers &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;md test &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;copy &lt;A href="file://serverx/bradshare/Book1.xlsx" mce_href="file:///\\serverx\bradshare\Book1.xlsx"&gt;\\serverx\bradshare\Book1.xlsx&lt;/A&gt; &lt;FONT color=#ff0000&gt;&amp;lt;-- Can’t make this happen as it goes off-box as the machine account. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;Access is denied.&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;C:\Windows\System32&amp;gt;cd\ &lt;/P&gt;
&lt;P&gt;C:\&amp;gt;cd debuggers &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;md test &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;copy &lt;A href="file://serverx/bradshare/Book1.xlsx" mce_href="file:///\\serverx\bradshare\Book1.xlsx"&gt;\\serverx\bradshare\Book1.xlsx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;Access is denied.&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;PS C:\Debuggers&amp;gt; &lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;I&gt;Example with credSSP:&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;PS C:\Debuggers&amp;gt; Invoke-Command -ComputerName server1.domain.com,server2.domain.com -ScriptBlock {c:\debuggers\test_PS.cmd} &lt;STRONG&gt;-Authentication CredSSP&lt;/STRONG&gt; -Credential reddom\brad&lt;/P&gt;
&lt;P&gt;//Had to use the FQDN as it does an SPN lookup and hostname fails. &lt;/P&gt;
&lt;P&gt;C:\Windows\System32&amp;gt;cd\ &lt;/P&gt;
&lt;P&gt;C:\&amp;gt;cd debuggers &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;md test &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;copy &lt;A href="file://serverx/bradshare/Book1.xlsx" mce_href="file:///\\serverx\bradshare\Book1.xlsx"&gt;\\serverx\bradshare\Book1.xlsx&lt;/A&gt; &lt;FONT color=#ff0000&gt;&amp;lt;-- Now goes off the server-side with my ‘brad’ user account.&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;1 file(s) copied. &lt;/P&gt;
&lt;P&gt;C:\Windows\System32&amp;gt;cd\ &lt;/P&gt;
&lt;P&gt;C:\&amp;gt;cd debuggers &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;md test &lt;/P&gt;
&lt;P&gt;C:\Debuggers&amp;gt;copy &lt;A href="file://serverx/bradrutk$/Book1.xlsx" mce_href="file:///\\serverx\bradrutk$\Book1.xlsx"&gt;\\serverx\bradrutk$\Book1.xlsx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;1 file(s) copied. &lt;/P&gt;
&lt;P&gt;PS C:\Debuggers&amp;gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;You must have at least the CTP2 verison of WINRM: &lt;A href="https://connect.microsoft.com/WSMAN/Downloads"&gt;https://connect.microsoft.com/WSMAN/Downloads&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to run Configure-Wsman.ps1 and WINRM quickconfig too...&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8b2ca5b2-c4e3-4de4-8de9-8ea3f10fad96 style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;A href="http://technorati.com/tags/powershell" rel=tag mce_href="http://technorati.com/tags/powershell"&gt;powershell&lt;/A&gt;&lt;/DIV&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3129131" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Business+up+front/default.aspx">Business up front</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Ghetto+scripting/default.aspx">Ghetto scripting</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Getting Access Denied when trying to query root\MSCluster namespace remotely against Windows 2008.</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/09/08/getting-access-denied-when-trying-to-query-root-mscluster-namespace-remotely-against-windows-2008.aspx</link><pubDate>Mon, 08 Sep 2008 21:00:56 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3121082</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3121082.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3121082</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Ran into a weird issue where I was getting access denied when trying to query nodes remotely in powershell.&amp;#160; The query was working fine against Windows 2003 cluster names and worked locally when ran on a Windows 2008 cluster node, it just didn’t work remotely.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Against 2k3:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;PS C:\Debuggers&amp;gt; gwmi -q &amp;quot;Select name from MSCluster_Node&amp;quot; -namespace root\mscluster -computername Server-2k3-01 | Select-Object Name &lt;/p&gt;  &lt;p&gt;Name   &lt;br /&gt;----    &lt;br /&gt;Server-2k3-01    &lt;br /&gt;Server-2k3-02&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Against 2k8:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#800000"&gt;PS C:\Debuggers&amp;gt; gwmi -q &amp;quot;Select name from MSCluster_Node&amp;quot; -namespace root\mscluster -computername Server-2k8-01     &lt;br /&gt;Get-WmiObject : Access denied      &lt;br /&gt;At line:1 char:5      &lt;br /&gt;+ gwmi &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;#160; -q &amp;quot;Select name from MSCluster_Node&amp;quot; -namespace root\mscluster -computername Server-2k8-01&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I also tried the query outside of powershell to eliminate that form the equation with the same results and it still failed.&amp;#160; So why the difference?&amp;#160; Well looking around on the target, I noticed this event in the event log:&lt;/p&gt;  &lt;p&gt;Log Name:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Application   &lt;br /&gt;Source:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Microsoft-Windows-WMI    &lt;br /&gt;Date:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 9/5/2008 10:17:52 AM    &lt;br /&gt;Event ID:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5605    &lt;br /&gt;Task Category: None    &lt;br /&gt;Level:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Error    &lt;br /&gt;Keywords:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Classic    &lt;br /&gt;User:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; N/A    &lt;br /&gt;Computer:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Server-2k8-01    &lt;br /&gt;Description:    &lt;br /&gt;Access to the root\mscluster namespace was denied because the namespace is marked with RequiresEncryption but the script or application attempted to connect to this namespace with an authentication level below Pkt_Privacy. Change the authentication level to Pkt_Privacy and run the script or application again.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Doing a little research I ran across this article explaining the event and what needs to happen to run the query properly:&lt;/p&gt; &lt;a title="http://technet.microsoft.com/en-us/library/cc727103.aspx" href="http://technet.microsoft.com/en-us/library/cc727103.aspx"&gt;http://technet.microsoft.com/en-us/library/cc727103.aspx&lt;/a&gt;  &lt;p&gt;In VBScript that means adding: &lt;strong&gt;authenticationLevel=pktPrivacy&lt;/strong&gt; to your query.&amp;#160; In Powershell (I’m using 2.0) you just add the authentication switch to get it to work.&amp;#160; Now the query works on downlevel as well as 2k8:&lt;/p&gt;  &lt;p&gt;PS C:\Debuggers&amp;gt; gwmi -q &amp;quot;Select name from MSCluster_Node&amp;quot; -namespace root\mscluster -computername Server-2k8-01 &lt;strong&gt;-Authentication PacketPrivacy&lt;/strong&gt; | Select-Object Name &lt;/p&gt;  &lt;p&gt;Name   &lt;br /&gt;----&lt;/p&gt;  &lt;p&gt;Server-2k8-01   &lt;br /&gt;Server-2k8-02    &lt;br /&gt;Server-2k8-03    &lt;br /&gt;Server-2k8-04    &lt;br /&gt;Server-2k8-05&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;PostScript:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You can do a whole bunch of cool stuff with powershell check it out!&amp;#160; Here’s just a little query to tell me each node and ‘t state:&lt;/p&gt;  &lt;p&gt;PS C:\Debuggers&amp;gt; gwmi -q &amp;quot;Select * from MSCluster_Node&amp;quot; -namespace root\mscluster -computername TK5-CLUS-01 -Authentication PacketPrivacy | Select-Object Name,State | Format-Table -au &lt;/p&gt;  &lt;p&gt;Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; State   &lt;br /&gt;----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -----    &lt;br /&gt;tk5-clus-01&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0    &lt;br /&gt;tk5-clus-02&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0    &lt;br /&gt;tk5-clus-03&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0    &lt;br /&gt;tk5-clus-04&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1    &lt;br /&gt;tk5-clus-05&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0    &lt;br /&gt;tk5-clus-06&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3121082" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Business+up+front/default.aspx">Business up front</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Ghetto+scripting/default.aspx">Ghetto scripting</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Windows+Server+2008/default.aspx">Windows Server 2008</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Find out who pings on a subnet quick and easy</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/04/24/find-out-who-pings-on-a-subnet-quick-and-easy.aspx</link><pubDate>Thu, 24 Apr 2008 02:57:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3043904</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3043904.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3043904</wfw:commentRss><description>&lt;P&gt;So i know there are tools out there to do this but figured some would be interested on how to do this real quick with stuff that's already in the OS.&lt;/P&gt;
&lt;P&gt;1) Turn off echos to make the out put clean (don’t forget to turn it back on when its done via “echo on”).&lt;/P&gt;
&lt;P&gt;2) The set is a sequence of numbers from start to end, by step amount.&amp;nbsp; So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1).&amp;nbsp; So in this instance 1,1,254 would step to 254.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;3) For the ping the –n says send one request instead the default of four.&amp;nbsp; the –w sets the timeout for the echo request to 300 milliseconds, since I knew the subnet was close, so I did not need to wait the full timeout for the packet to return.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;C:\debuggers&amp;gt;echo off &lt;BR&gt;for /L %a in (1,1,254) do ping -n 1 -w 300 20.232.12.%a |findstr /i reply &lt;BR&gt;Reply from 20.232.12.1: bytes=32 time=2ms TTL=245 &lt;BR&gt;Reply from 20.232.12.7: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.8: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.9: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.11: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.12: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.14: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.15: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.27: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.78: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.81: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.82: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.83: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.84: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.85: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.87: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.88: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.89: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.107: bytes=32 time=1ms TTL=53 &lt;BR&gt;Reply from 20.232.12.108: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.110: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.111: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.113: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.115: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.116: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.117: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.118: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.119: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.120: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.231: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.234: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.235: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.237: bytes=32 time=2ms TTL=55 &lt;BR&gt;Reply from 20.232.12.238: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.239: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.242: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.244: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.245: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.246: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.247: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.248: bytes=32 time=1ms TTL=55 &lt;BR&gt;Reply from 20.232.12.249: bytes=32 time=2ms TTL=53 &lt;BR&gt;Reply from 20.232.12.250: bytes=32 time=2ms TTL=55&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Update:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;And in powershell: &amp;nbsp;1..254 | % {ping -n 1 -w 300 157.56.144.$_ | findstr /i reply }&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3043904" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Business+up+front/default.aspx">Business up front</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Ghetto+scripting/default.aspx">Ghetto scripting</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Powershell/default.aspx">Powershell</category></item></channel></rss>