<?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 : Ghetto scripting</title><link>http://blogs.technet.com/brad_rutkowski/archive/tags/Ghetto+scripting/default.aspx</link><description>Tags: Ghetto scripting</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><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>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>Display warning text when someone logs onto your servers</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/09/25/display-warning-text-when-someone-logs-onto-your-servers.aspx</link><pubDate>Thu, 25 Sep 2008 03:25:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3128027</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/3128027.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=3128027</wfw:commentRss><description>&lt;P&gt;This works for Windows 2003 and Windows 2008.&amp;nbsp; We use it during our reliability study to let the server owners know that they shouldn't reboot their boxes without a good reason.&amp;nbsp; You can use it for whatever you’d like. :)&lt;/P&gt;
&lt;P&gt;&lt;B&gt;The two keys to set:&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;reg add "&lt;A href="file://brad-dc-01/HKLM/SOFTWARE/Microsoft/Windows%20NT/CurrentVersion/Winlogon"&gt;\\brad-dc-01\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon&lt;/A&gt;" /v LegalNoticeCaption /t REG_SZ /d "MSIT Reliability Study" /f&lt;/P&gt;
&lt;P&gt;reg add "&lt;A href="file://brad-dc-01/HKLM/SOFTWARE/Microsoft/Windows%20NT/CurrentVersion/Winlogon"&gt;\\brad-dc-01\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon&lt;/A&gt;" /v LegalNoticeText /t REG_SZ /d "This server is part of the MSIT Windows 7 Reliability Study.&amp;nbsp;&amp;nbsp; The server should not be rebooted.&amp;nbsp; If the server is experiencing a bug, please contact DCOPERATE to triage and they will escalate as needed.&amp;nbsp; If you are rebooting the server for a hotfix, private fix, or other legitimate reason, please document it properly in the shutdown tracker so that the statistics are accurate." /f&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Hop to loop it and apply it en masse:&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Open CMD with your alt creds and do the following:&lt;/P&gt;
&lt;P&gt;C:\Windows\system32&amp;gt;for /f %a in (machines.txt) do (&lt;/P&gt;
&lt;P&gt;More? reg add "&lt;A href="file://%25a/HKLM/SOFTWARE/Microsoft/Windows%20NT/CurrentVersion/Winlogon" mce_href="file:///\\%25a\HKLM\SOFTWARE\Microsoft\Windows%20NT\CurrentVersion\Winlogon"&gt;\\%a\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon&lt;/A&gt;" /v LegalNoticeCaption /t REG_SZ /d "MSIT Reliability Study" /f&lt;/P&gt;
&lt;P&gt;More? reg add "&lt;A href="file://%25a/HKLM/SOFTWARE/Microsoft/Windows%20NT/CurrentVersion/Winlogon"&gt;\\%a\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon&lt;/A&gt;" /v LegalNoticeText /t REG_SZ /d "This server is part of the... (HUGE LONG STRING) ... " /f&lt;/P&gt;
&lt;P&gt;More? )&lt;/P&gt;
&lt;P&gt;&lt;B&gt;How to turn it off:&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;C:\Windows\system32&amp;gt;for /f %a in (machines.txt) do (&lt;/P&gt;
&lt;P&gt;More? reg add "&lt;A href="file://%25a/HKLM/SOFTWARE/Microsoft/Windows%20NT/CurrentVersion/Winlogon" mce_href="file:///\\%25a\HKLM\SOFTWARE\Microsoft\Windows%20NT\CurrentVersion\Winlogon"&gt;\\%a\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon&lt;/A&gt;" /v LegalNoticeCaption /t REG_SZ /d "" /f&lt;/P&gt;
&lt;P&gt;More? reg add "&lt;A href="file://%25a/HKLM/SOFTWARE/Microsoft/Windows%20NT/CurrentVersion/Winlogon"&gt;\\%a\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon&lt;/A&gt;" /v LegalNoticeText /t REG_SZ /d "" /f&lt;/P&gt;
&lt;P&gt;More? )&lt;/P&gt;
&lt;P&gt;&lt;B&gt;The result:&lt;/B&gt;&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;IMG src="http://i149.photobucket.com/albums/s62/brad9987/Untitled.jpg" mce_src="http://i149.photobucket.com/albums/s62/brad9987/Untitled.jpg"&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way of doing this is to set "Interactive logon: Message text for users attempting to logon" in secpol.msc...&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5a496348-a141-46cf-8179-43ec5f3faeb6 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/Windows+2003" rel=tag mce_href="http://technorati.com/tags/Windows+2003"&gt;Windows 2003&lt;/A&gt;,&lt;A href="http://technorati.com/tags/Windows+2008" rel=tag mce_href="http://technorati.com/tags/Windows+2008"&gt;Windows 2008&lt;/A&gt;&lt;/DIV&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3128027" 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/Vista+and+Lognhorn/default.aspx">Vista and Lognhorn</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Windows+Server+2008/default.aspx">Windows Server 2008</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><item><title>Hey Admins! Gathering information from remote machines using WMI (the easy way).</title><link>http://blogs.technet.com/brad_rutkowski/archive/2008/03/14/hey-admins-gathering-information-from-remote-machines-using-wmi-the-easy-way.aspx</link><pubDate>Sat, 15 Mar 2008 00:48:55 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:2999943</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/2999943.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=2999943</wfw:commentRss><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Those who are just getting into scripting might be wondering how to query info from remote machines using WMI and how to find useful information to query.&amp;#160; When I started out trying to learn some of the WMI syntax and gathering info,&amp;#160; I started with &lt;/font&gt;&lt;a href="http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx" target="_blank"&gt;&lt;font size="2"&gt;ScriptoMatic&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;I found this tool to be quick and painless for finding out what could be pulled from WMI and how it was done, if you've never played with it, go grab it and check it out.&amp;#160;&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160; &lt;img src="http://i149.photobucket.com/albums/s62/brad9987/scriptomatic.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;When you click the &amp;quot;run&amp;quot; button it'll dump out whatever you asked scriptomatic to search for:&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;==========================================      &lt;br /&gt;Computer: ServerA       &lt;br /&gt;==========================================       &lt;br /&gt;Caption: Domain       &lt;br /&gt;ClientSiteName: NA-WA-SITE       &lt;br /&gt;CreationClassName: Win32_NTDomain       &lt;br /&gt;DcSiteName: NA-WA-SITE       &lt;br /&gt;Description: Domain       &lt;br /&gt;DnsForestName: microsoft.com       &lt;br /&gt;DomainControllerAddress: &lt;/font&gt;&lt;a href="file://\\2002:4898:dc5:33:218:feff:fe75:904"&gt;&lt;font size="2"&gt;\\2002:4898:dc5:33:218:feff:fe75:904&lt;/font&gt;&lt;/a&gt;     &lt;br /&gt;&lt;font size="2"&gt;DomainControllerAddressType: 1      &lt;br /&gt;DomainControllerName: &lt;a href="file://\\DC-DC-35"&gt;\\DC-DC-35&lt;/a&gt;       &lt;br /&gt;DomainGuid: {F488EF59-EEEF-11D2-A5DA-00805F9F34DE}       &lt;br /&gt;DomainName: Domain       &lt;br /&gt;DSDirectoryServiceFlag: True       &lt;br /&gt;DSDnsControllerFlag: False       &lt;br /&gt;DSDnsDomainFlag: False       &lt;br /&gt;DSDnsForestFlag: True       &lt;br /&gt;DSGlobalCatalogFlag: True       &lt;br /&gt;DSKerberosDistributionCenterFlag: True       &lt;br /&gt;DSPrimaryDomainControllerFlag: False       &lt;br /&gt;DSTimeServiceFlag: True       &lt;br /&gt;DSWritableFlag: True &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Name: Domain: Domain      &lt;br /&gt;PrimaryOwnerContact:       &lt;br /&gt;PrimaryOwnerName:       &lt;br /&gt;Roles:       &lt;br /&gt;Status: OK&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;u&gt;Other site with WMI scripts prepopulated for you:&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;WMI has a plethora of information that can be gathered locally or remotely from systems so it might be daunting to&amp;#160; find out what you want to gather.&amp;#160; I stumbled upon this site today and found a ton of stuff that will be useful to admins: &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394585(VS.85).aspx" target="_blank"&gt;&lt;font size="2"&gt;WMI Tasks for Scripts and Applications&lt;/font&gt;&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Here are the the task categories and descriptions from the page:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394586(VS.85).aspx"&gt;Accounts and Domains&lt;/a&gt;     &lt;br /&gt;Obtain information such as the computer domain or the currently logged-on user. Many domain- or account-related tasks are best performed with &lt;a href="http://msdn2.microsoft.com/en-us/library/aa772170(VS.85).aspx"&gt;ADSI&lt;/a&gt; scripts. For examples, see the TechNet ScriptCenter at &lt;a href="http://go.microsoft.com/FWLink/?LinkId=84103"&gt;http://www.microsoft.com/technet&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394587(VS.85).aspx"&gt;Computer Hardware&lt;/a&gt;     &lt;br /&gt;Obtain information about the presence, state, or properties of hardware components. For example, you can determine whether a computer is a desktop or laptop.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394588(VS.85).aspx"&gt;Computer Software&lt;/a&gt;     &lt;br /&gt;Obtain information such as which software is installed by the Windows Installer (MSI) and software versions.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394589(VS.85).aspx"&gt;Connecting to the WMI Service&lt;/a&gt;     &lt;br /&gt;To get data from WMI, either on the local computer or from a remote computer, you must connect to the WMI service by connecting to a specific &lt;a href="http://msdn2.microsoft.com/en-us/library/aa390820(VS.85).aspx"&gt;&lt;i&gt;namespace&lt;/i&gt;&lt;/a&gt;. In most cases, use either the shorthand &lt;a href="http://msdn2.microsoft.com/en-us/library/aa389763(VS.85).aspx"&gt;moniker&lt;/a&gt; connection or the &lt;a href="http://msdn2.microsoft.com/en-us/library/aa393720(VS.85).aspx"&gt;&lt;b&gt;Locator&lt;/b&gt;&lt;/a&gt; connection. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394590(VS.85).aspx"&gt;Dates and Times&lt;/a&gt;     &lt;br /&gt;Windows XP introduced several WMI classes and a scripting object to parse or convert the &lt;a href="http://msdn2.microsoft.com/en-us/library/aa389802(VS.85).aspx"&gt;CIM datetime&lt;/a&gt; format.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394591(VS.85).aspx"&gt;Desktop Management&lt;/a&gt;     &lt;br /&gt;Obtain data from or control remote desktops. For example, you can determine whether or not the screensaver requires a password. WMI also gives you the ability shut down a remote computer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394592(VS.85).aspx"&gt;Disks and File Systems&lt;/a&gt;     &lt;br /&gt;Obtain information about disk drive hardware state, logical volumes. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394593(VS.85).aspx"&gt;Event Logs&lt;/a&gt;     &lt;br /&gt;Obtain event data from NT Event log files and perform operations like backing up or clearing log files.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394594(VS.85).aspx"&gt;Files and Folders&lt;/a&gt;     &lt;br /&gt;Change file or folder properties through WMI, including creating a share or renaming a file.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394595(VS.85).aspx"&gt;Networking&lt;/a&gt;     &lt;br /&gt;Manage and obtain information about connections and IP or MAC addresses.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394596(VS.85).aspx"&gt;Operating Systems&lt;/a&gt;     &lt;br /&gt;Obtain information about the operating system such as version, whether it is activated, or which hotfixes are installed.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394597(VS.85).aspx"&gt;Performance Monitoring&lt;/a&gt;     &lt;br /&gt;Use the WMI classes that obtain data from performance counters to access and refresh data about computer performance.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394599(VS.85).aspx"&gt;Processes&lt;/a&gt;     &lt;br /&gt;Obtain information such as the account under which a process is running. You can perform actions like creating processes.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394598(VS.85).aspx"&gt;Printers and Printing&lt;/a&gt;     &lt;br /&gt;Manage and obtain data about printers, such as finding or setting the default printer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394600(VS.85).aspx"&gt;Registry&lt;/a&gt;     &lt;br /&gt;Create and modify registry keys and values.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394601(VS.85).aspx"&gt;Scheduled Tasks&lt;/a&gt;     &lt;br /&gt;Create and get information about scheduled tasks.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa394602(VS.85).aspx"&gt;Services&lt;/a&gt;     &lt;br /&gt;Obtain information about services, including dependent or antecedent services.&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;u&gt;One last thing:&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;Scritpomatic does have a twin for ADSI too: &lt;a href="http://www.microsoft.com/technet/scriptcenter/tools/admatic.mspx" target="_blank"&gt;ADSI ScriptoMatic.&lt;/a&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=2999943" 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/Cool+Tools/default.aspx">Cool Tools</category></item><item><title>Using TypePerf to get performance data on the command prompt.</title><link>http://blogs.technet.com/brad_rutkowski/archive/2007/09/22/using-typeperf-to-get-performance-data-on-the-command-prompt.aspx</link><pubDate>Sat, 22 Sep 2007 23:29:36 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:2020285</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/2020285.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=2020285</wfw:commentRss><description>&lt;p&gt;I was tracking a high CPU issue this week and needed to know when one of my servers was pegged so I could investigate.&amp;nbsp; I could of used perfmon I guess but I really like to do everything I can from the command prompt.&amp;nbsp; I always like it when there is a tool that can do data collection from the command prompt as this gives you the ability to easily script it if warranted. &lt;p&gt;&lt;a title="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/nt_command_typeperf.mspx?mfr=true" href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/nt_command_typeperf.mspx?mfr=true"&gt;http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/nt_command_typeperf.mspx?mfr=true&lt;/a&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;C:\Windows\system32&amp;gt;typeperf "\\Server1\Processor(_Total)\% Processor Time" &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;"(PDH-CSV 4.0)","\\Server1\Processor(_Total)\% Processor Time"&lt;br&gt;"09/20/2007 15:42:42.926","18.097697"&lt;br&gt;"09/20/2007 15:42:43.928","21.217785"&lt;br&gt;"09/20/2007 15:42:44.929","15.757631"&lt;br&gt;"09/20/2007 15:42:45.931","16.537653"&lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;The command completed successfully.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;You can collect any counter that lives in the perfmon world, I'm sure some of you out there will find a use for this.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;C:\Debuggers&amp;gt;typeperf "\\serverX\Server\Server Sessions" -sc 2 &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;"(PDH-CSV 4.0)","\\serverX\Server\Server Sessions"&lt;br&gt;"09/22/2007 13:21:54.110","8.000000"&lt;br&gt;"09/22/2007 13:21:55.117","8.000000" &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;The command completed successfully.&lt;/font&gt; &lt;p&gt;&lt;em&gt;Full Syntax below, you can adjust the collection in numerous ways.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;C:\Debuggers&amp;gt;typeperf -? &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Microsoft r TypePerf.exe (6.0.6001.16656) &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Typeperf writes performance data to the command window or to a log file. To stop Typeperf, press CTRL+C. &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Usage:&lt;br&gt;typeperf { &amp;lt;counter [counter ...]&amp;gt; | -cf &amp;lt;filename&amp;gt; | -q [object] | -qx [object] } [options] &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Parameters:&lt;br&gt;&amp;nbsp; &amp;lt;counter [counter ...]&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Performance counters to monitor. &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Options:&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; Displays context sensitive help.&lt;br&gt;&amp;nbsp; -f &amp;lt;CSV|TSV|BIN|SQL&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output file format. Default is CSV.&lt;br&gt;&amp;nbsp; -cf &amp;lt;filename&amp;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; File containing performance counters to monitor, one per line.&lt;br&gt;&amp;nbsp; -si &amp;lt;[[hh:]mm:]ss&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Time between samples. Default is 1 second.&lt;br&gt;&amp;nbsp; -o &amp;lt;filename&amp;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; Path of output file or SQL database. Default is STDOUT.&lt;br&gt;&amp;nbsp; -q [object]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List installed counters (no instances). To list counters for one object, include the object name, such as Processor.&lt;br&gt;&amp;nbsp; -qx [object]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List installed counters with instances. To list counters for one object, include the object name, such as Processor.&lt;br&gt;&amp;nbsp; -sc &amp;lt;samples&amp;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; Number of samples to collect. Default is to sample until CTRL+C.&lt;br&gt;&amp;nbsp; -config &amp;lt;filename&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settings file containing command options.&lt;br&gt;&amp;nbsp; -s &amp;lt;computer_name&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Server to monitor if no server is specified in the counter path.&lt;br&gt;&amp;nbsp; -y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Answer yes to all questions without prompting.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:d1da0965-b4a2-4739-bf80-7bc246d67720" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Windows%202008" rel="tag"&gt;Windows 2008&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Vista" rel="tag"&gt;Vista&lt;/a&gt;, &lt;a href="http://technorati.com/tags/XP" rel="tag"&gt;XP&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Admin" rel="tag"&gt;Admin&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=2020285" 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/Vista+and+Lognhorn/default.aspx">Vista and Lognhorn</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></item><item><title>Are there pending operations waiting for a reboot?</title><link>http://blogs.technet.com/brad_rutkowski/archive/2007/06/27/are-there-pending-operations-waiting-for-a-reboot.aspx</link><pubDate>Wed, 27 Jun 2007 19:21:20 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1377409</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/1377409.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=1377409</wfw:commentRss><description>&lt;p&gt;Sometimes you might log onto a server and wonder if there have been patches installed and thing needs to be rebooted.&amp;nbsp; Well if the patch wanted to replace a file that was in use by the system (like NTFS for example) then it populates a certain key in the registry, you could check this key to determine if a reboot is pending.&lt;/p&gt; &lt;p&gt;Value: &lt;a title="PendingFileRenameOperations" href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/58499.mspx?mfr=true" target="_blank"&gt;PendingFileRenameOperations&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Location: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager  &lt;p&gt;&lt;b&gt;Description:&lt;/b&gt; &lt;p&gt;Stores the names of files to be renamed when the system restarts. &lt;p&gt;This entry consists of pairs of file names. The file specified in the first item of the pair is renamed to match the second item of the pair. The system adds this entry to the registry when a user or program tries to rename a file that is in use. The file names are stored in the value of this entry until the system is restarted and they are renamed. &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;em&gt;Server that doesn't need to be rebooted for pending files:&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;C:\&amp;gt;reg query "\\server1\hklm\System\CurrentControlSet\Control\Session Manager" /v PendingFileRenameOperations &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;ERROR: The system was unable to find the specified registry key or value.&lt;/font&gt; &lt;p&gt;&lt;em&gt;Server that does need to be rebooted for pending files:&lt;/em&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;C:\&amp;gt;reg query "\\server2\hklm\System\CurrentControlSet\Control\Session Manager" /v PendingFileRenameOperations &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PendingFileRenameOperations&amp;nbsp;&amp;nbsp;&amp;nbsp; REG_MULTI_SZ&amp;nbsp;&amp;nbsp;&amp;nbsp; \??\C:\WINDOWS\system32\SET2B5.tmp\0!\??\C:\WINDOWS\system32\schannel.dll\0\??\C:\WINDOWS\system32\_000025_.tmp.dll\0\??\C:\WINDOWS\system32\SET2B9.tmp\0!\??\C:\WINDOWS\system32\urlmon.dll\0\??\C:\WINDOWS\system32\SET2BA.tmp\0!\??\C:\WINDOWS\system32\shdocvw.dll\0\??\C:\WINDOWS\system32\SET2CA.tmp\0!\??\C:\WINDOWS\system32\kernel32.dll&lt;/font&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:d7dc316c-2d6d-4644-8655-9e28e1eed88f" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/windows%202003" rel="tag"&gt;windows 2003&lt;/a&gt;, &lt;a href="http://technorati.com/tags/vista" rel="tag"&gt;vista&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1377409" 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/Vista+and+Lognhorn/default.aspx">Vista and Lognhorn</category><category domain="http://blogs.technet.com/brad_rutkowski/archive/tags/Windows+2003/default.aspx">Windows 2003</category></item><item><title>Republish printers easily on a print server to Active Directory.</title><link>http://blogs.technet.com/brad_rutkowski/archive/2007/06/25/republish-printers-easily-on-a-print-server-to-active-directory.aspx</link><pubDate>Mon, 25 Jun 2007 22:16:04 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1359205</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/1359205.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=1359205</wfw:commentRss><description>&lt;p&gt;&lt;img height="120" src="http://www.microsoft.com/mspress/books/sampchap/4754/0735611580-2.gif" width="186"&gt; &lt;/p&gt; &lt;p&gt;Printers can get pruned from the directory for many reasons.&amp;nbsp; The way it is supposed to work is if the printer is stale then a DC will remove the print queue object from the directory after trying to contact it 3 times at 8 hour intervals (default).&amp;nbsp; This also means that if a DC can't net view the print server for a 24 hour period it could potentially&amp;nbsp;prune the print queue objects too.&amp;nbsp; This can happen if one of your&amp;nbsp;domain controllers&amp;nbsp;are in a "bad" state where its online but not functioning as expected.&amp;nbsp;&lt;/p&gt; &lt;p&gt;So what can you do once the print queue objects have been removed?&amp;nbsp; Well to easily republish them you can create a simple script like below.&amp;nbsp;You can then save this as a vbs and then use it to republish the printers in the directory.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;If WScript.Arguments.Count &amp;lt;&amp;gt; 1 then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strPC = GetPC()&lt;br&gt;Else&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strPC = wscript.arguments(0) &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Set objWMIService = GetObject("winmgmts:\\" &amp;amp; strPC &amp;amp; "\root\cimv2")&lt;br&gt;Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)&lt;br&gt;For Each objItem in colItems&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wscript.Echo "ShareName: " &amp;amp; objItem.ShareName&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objItem.Published = False&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objItem.Put_&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wscript.Echo "Published: " &amp;amp; objItem.Published&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objItem.Published = True&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objItem.Put_&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wscript.Echo "Published: " &amp;amp; objItem.Published&lt;br&gt;Next &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;function GetPC()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetPC = InputBox ("What Server would you like republish the printers on?", "Servername")&lt;br&gt;End function&lt;/font&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;To work around this you could do a number of things:&lt;/p&gt; &lt;p&gt;1) Fix the network connectivity issue&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;a) Find out what Dc is not working as expected and resolve.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;2) Disable the spooler service on your DCs&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;a) Could have lots of stale printers to manually clean up if you have printers in flux in your environment&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;3) Disable pruning via GPO&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;a) Set the Directory Pruning Interval value to Never via GPO&lt;/p&gt; &lt;p&gt;b) There will be stale printers in the directory and they will need to be manually cleaned up.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;4) You can allow the printers to be pruned and set the Check Published State policy for specific (or all) print servers in the domain. This policy causes the&amp;nbsp;&amp;nbsp;&amp;nbsp; spooler on a print server to periodically verify that its published printers exist in Active Directory. By default, the Spooler service verifies the state of published printers only when it is started. &lt;blockquote&gt; &lt;p&gt;a) Because the widespread use of this policy on many computers in the domain (that are constantly checking the publication status of their PrintQueue objects in Active Directory) can adversely affect network performance. Microsoft recommends that you set this policy only on the main production print servers.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;If you want to know more about how printers are published and pruned &lt;a title="Printer Publishing and Pruning" href="http://www.windowsitpro.com/Windows/Articles/ArticleID/41104/pg/1/1.html" target="_blank"&gt;this&lt;/a&gt; is a thorough article on the subject.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1359205" 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/DS/default.aspx">DS</category></item><item><title>Need an easy way to create a unique file name with the date?</title><link>http://blogs.technet.com/brad_rutkowski/archive/2007/04/12/need-an-easy-way-to-create-a-unique-file-name-with-the-time-date.aspx</link><pubDate>Thu, 12 Apr 2007 22:46:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:755659</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/755659.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=755659</wfw:commentRss><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I needed to dump winlogon and do some checks against the dump file and needed and easy way to get the computername and date in the file name and formatted so I could easily perfrom next steps.&amp;nbsp; Here was the soution: 
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;C:\Debuggers&amp;gt;echo %computername%_%DATE:~10,4%.%DATE:~4,2%.%DATE:~7,2%&lt;BR&gt;SK8ORDIE_2007.04.12&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Here was the script I was running to do some checks and get a dump of winlogon...&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;c:\debuggers\tlist -v |findstr /c:" 0 " |findstr "winlogon.exe" &amp;gt; c:\tlist.txt &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;for /f "tokens=3" %%a in (c:\tlist.txt) do SET PID=%%a &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;echo %PID% &lt;/FONT&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;C:\debuggers\cdb -p %PID% -pvr -c ".dump /ma C:\debuggers\%computername%_%DATE:~10,4%.%DATE:~4,2%.%DATE:~7,2%_winlogon.dmp;qd" &lt;FONT color=#ff0000&gt;//Noninvasive attach to the process (pvr) gets userdump and quits.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;P&gt;&lt;FONT size=1&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;del /f c:\tlist.txt&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=1&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=1&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=755659" 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></item><item><title>Hey I forgot to turn on RDP on my server!</title><link>http://blogs.technet.com/brad_rutkowski/archive/2006/10/18/hey-i-forgot-to-turn-on-rdp-on-my-server.aspx</link><pubDate>Wed, 18 Oct 2006 19:07:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:471878</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/471878.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=471878</wfw:commentRss><description>&lt;P&gt;Ever find yourself away from your server after building it out and forgot to turn on RDP so you could TS onto the machine?&amp;nbsp; Well in XP and 2k3, you can just toggle a reg key and most of the time (pending firewall issues) you can then TS into the box.&amp;nbsp; Doesn't work in Windows 2000 as you need to install a service for TS, which is why the script checks that below.&lt;/P&gt;
&lt;P&gt;Here's an easy script that you can save as a cmd file that will work...&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;@echo off &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;IF "%1"=="?" GOTO SYNTAX&lt;BR&gt;IF "%1"=="/?" GOTO SYNTAX&lt;BR&gt;IF "%1"=="-?" GOTO SYNTAX &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;reg query "\\%1\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber |findstr CurrentBuildNumber &amp;gt;&amp;gt; c:\tmp.txt&lt;BR&gt;for /f "tokens=3" %%a in (c:\tmp.txt) do (&lt;BR&gt;if %%a LSS 2600 goto :W2k)&lt;BR&gt;reg query "\\%1\HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections&lt;BR&gt;reg add "\\%1\HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0&lt;BR&gt;reg query "\\%1\HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections&lt;BR&gt;goto :EOF &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;:W2k&lt;BR&gt;Echo.&lt;BR&gt;Echo Server is Windows 2000 or below, this command can only be run on XP or Windows Server 2003&lt;BR&gt;Echo.&lt;BR&gt;goto :EOF &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;:SYNTAX&lt;BR&gt;ECHO.&lt;BR&gt;ECHO --------------------------------------------------------------------------------------&lt;BR&gt;ECHO RDP.cmd : Turn on Remote Admin mode terminal service in XP/Windows Server 2003&lt;BR&gt;ECHO --------------------------------------------------------------------------------------&lt;BR&gt;ECHO.&lt;BR&gt;ECHO Usage: RDP.cmd servername (You must be an admin on the box)&lt;BR&gt;ECHO -------------------------------------------------------------------------------------- &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;:EOF&lt;BR&gt;if exist c:\tmp.txt( del /Q c:\tmp.txt ) 1&amp;gt;nul 2&amp;gt;nul&lt;/FONT&gt; &lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=0767317B-992E-4b12-91E0-4F059A8CECA8:ca751377-dd34-4d4c-b7b3-d3f14e06f51b contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati tags: &lt;A href="http://technorati.com/tags/RDP" rel=tag mce_href="http://technorati.com/tags/RDP"&gt;RDP&lt;/A&gt;, &lt;A href="http://technorati.com/tags/AD" rel=tag mce_href="http://technorati.com/tags/AD"&gt;AD&lt;/A&gt;, &lt;A href="http://technorati.com/tags/Active%20Directory" rel=tag mce_href="http://technorati.com/tags/Active%20Directory"&gt;Active Directory&lt;/A&gt;, &lt;A href="http://technorati.com/tags/Scripting" rel=tag mce_href="http://technorati.com/tags/Scripting"&gt;Scripting&lt;/A&gt;, &lt;A href="http://technorati.com/tags/Wnidows" rel=tag mce_href="http://technorati.com/tags/Wnidows"&gt;Wnidows&lt;/A&gt;&lt;/DIV&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=471878" 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></item><item><title>Dumping out all the DCs in a domain to a txt file</title><link>http://blogs.technet.com/brad_rutkowski/archive/2006/10/17/dumping-out-all-the-dcs-in-a-domain-to-a-txt-file.aspx</link><pubDate>Tue, 17 Oct 2006 20:47:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:471088</guid><dc:creator>Brad Rutkowski</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.technet.com/brad_rutkowski/comments/471088.aspx</comments><wfw:commentRss>http://blogs.technet.com/brad_rutkowski/commentrss.aspx?PostID=471088</wfw:commentRss><description>&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;Short and sweet way of dumping out the DCs to a txt file, in a script:&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for /f "skip=1" %%a in ('netdom query dc /domain:YOURDOMAIN') do (if %%a == The (echo.) else echo %%a &amp;gt;&amp;gt; test.txt)&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;So what's&amp;nbsp;the deal with all the syntax, and how would this be useful?&amp;nbsp; Well if you do simple admin scripting then this is pretty useful, say you want to look at all the DCs in the forest and check to make sure that they all have a certain reg key (sample below), well you could create a simple cmd script in about 5 minutes using the above line and the use reg query to do the dirty work.&amp;nbsp; Hope you can find a use for this, my next post will use this to demonstrate how to do some ghetto time skew monitoring on DCs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;Syntax breaks down like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/f &lt;FONT color=#0000ff&gt;is needed because we are using a command to pull the variable %a ('netdom query dc /domain:YOURDOMAIN')&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;"skip=1" &lt;FONT color=#0000ff&gt;We use this so that we skip the first line of the output from netdom query dc which looks like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;C:\localbinx64&amp;gt;netdom query dc /domain:braddom&lt;BR&gt;&lt;STRONG&gt;List of domain controllers with accounts in the domain:&lt;/STRONG&gt;&amp;nbsp; &amp;lt;-- Skips this line.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;BRAD-DC-20&lt;BR&gt;BRAD-DC-22&lt;BR&gt;BRAD-DC-26&lt;BR&gt;BRAD-DC-15&lt;BR&gt;&lt;STRONG&gt;The command completed successfully. &lt;/STRONG&gt;&amp;lt;-- Don't want this either see below on how we get around this.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;(if %%a == The (echo.) else echo %%a &amp;gt;&amp;gt; test.txt) &lt;FONT color=#0000ff&gt;And what's all this?&amp;nbsp; Well its my way of getting around the last line.&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;Here is a script that uses this technique and checks the strict replication key, I don't dump&amp;nbsp;the servers&amp;nbsp;to a txt file because hey I dont need to, just save this into a cmd file...&amp;nbsp; Play around to figure our what the findstr does.&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;@echo off &lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;for /f "skip=1" %%a in ('netdom query dc /domain:Yourdomain') do (&lt;BR&gt;if %%a == The (echo.) &lt;BR&gt;echo %%a&lt;BR&gt;reg query \\%%a\HKLM\system\currentcontrolset\services\ntds\parameters /v "strict replication consistency" |findstr /i strict)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Output looks like:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;C:\&amp;gt;strict.cmd&lt;BR&gt;BRAD-DC-20&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-22&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-26&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-05&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-27&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-10&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-11&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-25&lt;BR&gt;ERROR: The system was unable to find the specified registry key or value.&lt;BR&gt;BRAD-DC-24&lt;BR&gt;ERROR: The system was unable to find the specified registry key or value.&lt;BR&gt;BRAD-DC-35&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-04&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-03&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-23&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-14&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-08&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-18&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;BR&gt;BRAD-DC-15&lt;BR&gt;strict replication consistency REG_DWORD 0x1&lt;/FONT&gt; 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=0767317B-992E-4b12-91E0-4F059A8CECA8:40b20f0c-cc62-4dc3-84b0-9d9b2bb8232d contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati tags: &lt;A href="http://technorati.com/tags/Active%20Directory" rel=tag mce_href="http://technorati.com/tags/Active%20Directory"&gt;Active Directory&lt;/A&gt;, &lt;A href="http://technorati.com/tags/Directory%20Service" rel=tag mce_href="http://technorati.com/tags/Directory%20Service"&gt;Directory Service&lt;/A&gt;, &lt;A href="http://technorati.com/tags/AD" rel=tag mce_href="http://technorati.com/tags/AD"&gt;AD&lt;/A&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=0767317B-992E-4b12-91E0-4F059A8CECA8:87a5385e-0e36-4db0-a9c5-23afdd95eac1 contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;IceRocket tags: &lt;A href="http://blogs.icerocket.com/search?q=Active%20Directory" rel=tag mce_href="http://blogs.icerocket.com/search?q=Active%20Directory"&gt;Active Directory&lt;/A&gt;&lt;/DIV&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=471088" 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/DS/default.aspx">DS</category></item></channel></rss>