<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Clint Huffman's Windows Troubleshooting in the Field Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/clinth/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/clinth/feed.xml</link>
    <description>Clint Huffman is a Microsoft Premier Field Engineer (PFE) who has been with Microsoft for over 10 years. This blog documents the challenges he faces week to week in hopes that these experiences will help others.</description>
    <lastBuildDate>Thu, 20 Jul 2017 21:54:52 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Automating the Sysinternals "Hunting Malware" technique</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/automating-the-sysinternals-hunting-malware-technique</link>
      <pubDate>Wed, 07 Sep 2016 03:00:10 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/?p=595</guid>
      <description><![CDATA[My friends and family often ask for my help in fixing their computer. I actually enjoy it, but I...]]></description>
      <content:encoded><![CDATA[My friends and family often ask for my help in fixing their computer. I actually enjoy it, but I can't be there for them all the time. When I "fix" their Microsoft Windows PC, I use <a href="https://live.sysinternals.com/Files/SysinternalsMalwareCleaning.pdf">Mark Russinovich's Hunting Malware procedure</a>. This can take quite a bit of time and effort depending on how bad the system is overwhelmed.

My interpretation of Mark's technique:
<ol>
 	<li>Unplug the system from the network</li>
 	<li>Run Process Explorer, click Options, Verify Image Signatures, and Options, VirusTotal, Check VirusTotal.com.</li>
 	<li>Add the Verified Signer  and VirusTotal columns if not already visible.</li>
 	<li>Suspend any process that is unverified and/or ranks high (red) in the VirusTotal column. Suspend is necessary at first since many unwanted software will have a "brother" that will re-spawn the other.</li>
 	<li>Kill all of the processes you just suspended.</li>
 	<li>Follow up with Autoruns.exe to "root out" the unwanted software.</li>
 	<li>Reboot and repeat as necessary.</li>
</ol>
To make everyone's life a bit easier, I wrote the Aggressive System Sanitizer or "BadASS" for a short, catchy name. It basically sees any process that is unsigned to be a foe. Any process that is signed, but the publisher is not on the "trusted" list will also be considered a "foe". Processes that are signed and on the "trusted" list are considered "friendly". The "trusted" list is populated with a static list of well known publishers such as Microsoft. In addition, the manufacturer of the PC is also trusted even it if is not statically on the list.

<strong>IMPORTANT: This is *not* a replacement for anti-virus software. This is intended as a last resort to allow you to gain back control of your system temporarily. Consider options such as restoring your system to a known good restore point, restoring to a known good backup, or resetting the device to factory defaults.</strong>

The "BadASS" Powershell script automates steps 2 through 5 above at this time. It downloads the appropriate Sysinternals tools, runs SigCheck.exe to scan each process image (executable) and then presents you with a list of "suspects" ready for the chopping block. You can respond with Y (yes) or N (no) to kill them off or spare them. Keep in mind that the unwanted software can certainly be re-spawned, so this is not a permanent solution until the software is killed off from its starting point, so you will still want to follow step 6 and 7 manually until I can automate that part too.

Download the BadASS Powershell script from my personal OneDrive at:
<a href="https://aka.ms/ClintH">https://aka.ms/ClintH</a>
... and then, go to the BadASS folder.

Also, I will likely convert this into some kind of Powershell module and publish it to the Powershell Gallery soon.

I hope this makes your life a bit easier.]]></content:encoded>
    </item>
    <item>
      <title>Available for pre-order: Windows Performance Analysis Field Guide</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/available-for-pre-order-windows-performance-analysis-field-guide</link>
      <pubDate>Thu, 10 Jul 2014 17:43:12 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2014/07/10/available-for-pre-order-windows-performance-analysis-field-guide/</guid>
      <description><![CDATA[Yay! After over a year in development, my book, the “Windows Performance Analysis Field Guide”, is...]]></description>
      <content:encoded><![CDATA[<p>Yay! After over a year in development, my book, the “Windows Performance Analysis Field Guide”, is available for pre-order! <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/clip_image002_57E34034.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/clip_5F00_image002_5F00_57E34034.jpg"><img title="clip_image002" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/clip_image002_thumb_30A8F6FF.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/clip_5F00_image002_5F00_thumb_5F00_30A8F6FF.jpg" width="178" height="219" /></a> <p>$37.46 at <a href="https://store.elsevier.com/product.jsp?isbn=9780124167018&amp;_requestid=465338">https://store.elsevier.com/product.jsp?isbn=9780124167018&amp;_requestid=465338</a> <p>$45.42 (Prime discount) at <a href="https://www.amazon.com/dp/0124167012/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=12JDCG3UP69SD&amp;coliid=I2TOVTYHI6HDHC">https://www.amazon.com/dp/0124167012/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=12JDCG3UP69SD&amp;coliid=I2TOVTYHI6HDHC</a> <p>I certainly don’t know everything about Windows performance analysis (no one ever will), so *<b>many</b>* of my friends and colleagues are named in the book as people who have helped me along the way. <p>A special thanks to Microsoft Premier Field Engineering (PFE), Jeff Stokes, Yong Rhee, Ed Wilson, and Mario Hewardt for helping to make this book possible.</p></p></p></p></p></p>]]></content:encoded>
    </item>
    <item>
      <title>How to create a “black box” performance counter data collector</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/how-to-create-a-black-box-performance-counter-data-collector</link>
      <pubDate>Fri, 23 May 2014 16:15:52 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2014/05/23/how-to-create-a-black-box-performance-counter-data-collector/</guid>
      <description><![CDATA[I highly encourage my customers to run a “black box” performance counter data collector set on their...]]></description>
      <content:encoded><![CDATA[<p>I highly encourage my customers to run a “black box” performance counter data collector set on their Windows Servers. The purpose of it is to continuously collect a detailed amount of data about the system in a circular file buffer of adjustable size so what if/when the system has a performance problem, we have roughly 24 hours of data leading up to the problem. <p>This article is a walk through of how to create a performance counter data collector set template with all of the performance counters used by industry experts, how to import the template onto a local or remote system, and how to automatically start the data collector set at Windows start up – Performance Monitor does not have a feature to automatically start a data collector set after a reboot. <p>This procedure was tested on Windows 8.1 and Windows Server 2012 R2, but should work fine on Windows Vista, Windows Server 2008, and later operating systems. <p>&nbsp; <h2>Create a “black box” performance counter data collector template</h2> <p>First, determine the Microsoft products and services installed on the target system. In this example, I have a customer who needs a data collector set template for a Microsoft Windows Server 2012 R2 system running a named instance of Microsoft SQL Server 2012. Therefore, I want to target performance counters for both Windows Server 2012 R2 as well as SQL Server 2012.  <p>Arguably the easiest way to do this is to install the <a href="https://pal.codeplex.com/" target="_blank">Performance Analysis of Logs (PAL)</a> tool – an open source project/tool of mine. It requires Powershell 2.0 and the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=14422" target="_blank">Microsoft Chart Controls for the .NET Framework 3.5</a> – both are free products from Microsoft. Once installed, run the PAL Wizard from the Windows Start menu and navigate directly to the Threshold File tab. Select a threshold file or combination of threshold files (they can be mixed and matched through the inheritance pane, and click the Export to Perfmon template file button. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_77CD022A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_77CD022A.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_3E49F233.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_3E49F233.png" width="244" height="196" /></a>  <p>In this case, I selected Microsoft SQL Server 2012 which already has an inheritance of System Overview and Quick System Overview which are good for all Microsoft Windows operating systems. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_52CF41B1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_52CF41B1.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_6754912F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_6754912F.png" width="244" height="188" /></a>  <p>Since SQL Server might have named instances, the PAL tool detected SQL counters and prompts me to name any SQL named instances. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_4DEC8DF5.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_4DEC8DF5.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_028CEA31.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_028CEA31.png" width="244" height="104" /></a>  <p>In this case, I specified “SQL2” and saved it as an XML file which is the format that Windows Server 2008 and later uses for counter log templates. Once the XML file is saved. Optionally, open it in Notepad to verify that it has the counters that you expect to see. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_6924E6F6.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_6924E6F6.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_4180FB7D.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_4180FB7D.png" width="230" height="244" /></a>  <p>This template is a good start, but will require additional modifications to make it a circular log. <p>&nbsp; <h2>Create a performance counter data collector using the template</h2> <p>Copy the XML template that you created in the previous step to a file system or network share location that is accessible to your domain account. This could be the a local disk drive on your workstation, a local disk drive on the target system, or a network share that your workstation or the target server has access to. <p>On your workstation or at the console of the target system, open an Administrator command prompt. This procedure requires administrator rights on the target system.  <p>Run the following command to create a data collector using the template: <p><font face="Courier New">logman import &lt;NameOfDataCollectorSet&gt; -xml &lt;PathToXmlTemplate&gt; -s &lt;NameOfTargetSystem&gt;</font> <p>Here is an example of me creating the data collector set named, “SQL2_Blackbox_darksteel” (the %computername% resolves to the local computer name using the template I created earlier, “Sql2Template.xml”, on a remote system called, “darksteel”. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_4ADCC0B1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_4ADCC0B1.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_5F62102F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_5F62102F.png" width="244" height="44" /></a>  <p>Run the following command to check if the data collector set was created: <p><font face="Courier New">logman query</font> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_2CFE3CB0.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_2CFE3CB0.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_7A9A6930.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_7A9A6930.png" width="244" height="61" /></a>  <p>Note that the data collector set has not been started yet. Do not start it just yet. <p>Update the data collector set to be in binary circular format with a log file maximum size of 300 MB or a size that you prefer. <p><font face="Courier New">logman update &lt;NameOfDataCollectorSet&gt; –f bincirc –max &lt;SizeOfLogInMB&gt;</font> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_3345133E.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_3345133E.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_75B7B574.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_75B7B574.png" width="244" height="53" /></a>  <p>Now, the data collector set can be started and left to run forever without ever being larger than the size specified. <p>Optionally, the output location can be changed using the following sample command:<br /><font face="Courier New">logman update SQL2_Blackbox_DARKSTEEL -o D:\Perflogs\SQL2_Blackbox_DARKSTEEL.blg</font>  <p>This file path is in respect to the file system on the target system – not the workstation from which the command might be running. <p><strong><font color="#ff0000">Important:</font></strong> Ensure that the output directory location does not already contain data. Performance Monitor’s Data Management features might delete data at that location. <p>To start the data collector, run the following command: <p><font face="Courier New">logman start &lt;NameOfDataCollectorSet&gt;</font> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_5C4FB23A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_5C4FB23A.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_50B9F4FB.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_50B9F4FB.png" width="244" height="72" /></a>  <p>&nbsp; <h2>Setup the data collector set to start on the startup of Windows</h2> <p>Unfortunately, Performance Monitor does not provide a way to automatically start the data collector set after a reboot. This means all of your hard work of creating a “black box” data recorder will be for nothing after someone reboots the system. In this step, we will setup the data collector set to automatically start when Windows starts by using Task Scheduler. <p><strong>Run the following command in order to have the data collector set automatically start after a reboot:</strong></p> <p><font face="Courier New">schtasks /create /tn &lt;NameOfDataCollectorSetOrAUniqueName&gt; /sc onstart /tr &quot;logman start &lt;NameOfDataCollectorSet&gt;&quot; /ru system /S &lt;NameOfTargetSystem&gt;</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_3751F1C1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_3751F1C1.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_32DB70FA.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_32DB70FA.png" width="244" height="34" /></a>  <p>Note: The /S parameter of schtasks can be used to create this task on a target, remote, system. <p>Now the data collector set will automatically be started when the system starts. <p>&nbsp; <h2>Setup the data collector set to delete the oldest log file when low on disk space</h2> <p>By default, data collector sets will create a unique counter log each time it is started. This is to prevent the deletion of the existing logs. This is a nice feature, but this can result in several log files that might just be taking up too much disk space. <p>To setup the data collector set to delete the oldest log file when the disk space is low, open Performance Monitor (Start, Run, Perfmon.exe). Expand Data Collector Sets, expand User Defined and select the data collector set you wish to target for this. Right click on the data collector set and click Data Manager. <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_2745B3BB.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_2745B3BB.png"><img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/image_thumb_74E1E03B.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/image_5F00_thumb_5F00_74E1E03B.png" width="219" height="244" /></a>  <p>In this case, I setup the data collector set to delete the oldest counter log file. <p><strong><font color="#ff0000">Important:</font></strong> This setting can potentially delete existing data in the output directory location. Ensure that the output directory location *only* contains counter log files for this data collector. Avoid paths such as the root of a disk drive. <p>&nbsp; <h2>Conclusion</h2> <p>After following these steps you will have a data collector set that can run indefinitely without running the system out of disk space – it stays at the maximum size or smaller. Just stop the data collector set (the data collector set must be stopped before moving the counter log file otherwise it can result in file corruption) and analyze the counter log with the <a href="https://pal.codeplex.com/" target="_blank">Performance Analysis of Logs (PAL)</a> tool. <p>Want more? These procedures and *much* more is covered in my book, “The Windows Performance Analysis Field Guide” due out in August 2014.</p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p></p>]]></content:encoded>
    </item>
    <item>
      <title>Using Autoruns to validate system drivers</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/using-autoruns-to-validate-system-drivers</link>
      <pubDate>Thu, 21 Nov 2013 15:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/11/21/using-autoruns-to-validate-system-drivers/</guid>
      <description><![CDATA[Recently, one of my enterprise customers had a system crash popularly known as a &ldquo;blue screen...]]></description>
      <content:encoded><![CDATA[<p>Recently, one of my enterprise customers had a system crash popularly known as a &ldquo;blue screen of death&rdquo; and this reminded me of the importance to validate drivers. Validating drivers is something I commonly do with my non-techie friends and family as well, simply because poorly written drivers are the most common cause of system crashes.</p>
<p>A relatively quick and easy way of validating the drivers of a system is to use the Sysinternals (Microsoft owned) tool, <a href="https://live.sysinternals.com/autoruns.exe" target="_blank">Autoruns</a>. Autoruns is a free tool that does not require installation. Just download and run. For more information on Autoruns go to <a title="https://technet.microsoft.com/en-us/sysinternals/bb963902" href="https://technet.microsoft.com/en-us/sysinternals/bb963902">https://technet.microsoft.com/en-us/sysinternals/bb963902</a> and consider reading the book, &ldquo;<a href="https://technet.microsoft.com/en-us/sysinternals/hh290819" target="_blank">Windows Sysinternals Administrator&rsquo;s Reference</a>&rdquo;.</p>
<ol>
<li><strong>Download and launch Autoruns.exe</strong></li>
</ol><ol>
<li>Download Autoruns using one of the links above or click <a href="https://live.sysinternals.com/autoruns.exe" target="_blank">here</a> and save it to your desktop.</li>
<li>Double-click on it to run it.&nbsp; <br /><strong>Note:</strong> Administrator rights is not required unless you intend to make changes to the system. Also, you might be prompted for Administrator credentials or other User Access Control (UAC) prompts depending on your settings.</li>
<li>Autoruns will begin to gather system information. For now, press the ESC key to stop the gathering of data since we will be rescanning the system shortly. Otherwise, wait for the Status bar to reports, &ldquo;Ready&rdquo;.</li>
</ol>
<ul><li><strong>Filter Autoruns:</strong> This step will remove common entries that are relatively safe and enable verification of the signatures of the drivers, EXEs and DLLs of software targeted for startup on the system. <br /><strong>Note:</strong> Microsoft drivers are certainly not immune to problems, but they are generally written well enough to not be on the list of usual suspects.</li>
</ul><ol>
<li>In the menu, click <strong>Options</strong>, <strong>Filter Options</strong>.</li>
<li>Enable/check <strong>Verify code signatures</strong>, <strong>Hide Microsoft entries</strong>, and <strong>Hide Windows entries. <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/8562.image_290F9296.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/8562.image_5F00_290F9296.png"><img width="244" height="162" title="image" style="display:inline;" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/5751.image_thumb_3675A59C.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/5751.image_5F00_thumb_5F00_3675A59C.png" border="0" /></a> <br /></strong></li>
<li>Click the <strong>Rescan</strong> button and wait for the hour glasses to go away. Again, this might take a few minutes depending on the resources of the system.</li>
</ol>
<ul><li><strong>Validate drivers:</strong> This step checks non-Microsoft drivers. According to the Windows Sysinternals Administrator&rsquo;s Reference, &ldquo;Verifying a digital signature associated with that file gives a much higher degree of assurance of the file&rsquo;s authenticity and integrity.&rdquo; <br /><strong>Note:</strong> When a driver is verified, the Publisher field changes from the company name to the name on the signed certificate.</li>
</ul><ol>
<li>Click the <strong>Drivers</strong> tab and look for drivers that are &ldquo;Not Verified&rdquo;. This will show up in the Publisher field.</li>
<li>In my case, I found one driver that is not Microsoft, but it was verified to be a virtual networking vendor. <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/0068.image_3D28AF1F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/0068.image_5F00_3D28AF1F.png"><img width="244" height="132" title="image" style="display:inline;" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3223.image_thumb_71C90B5A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3223.image_5F00_thumb_5F00_71C90B5A.png" border="0" /></a>&nbsp;</li>
<li>If any of the drivers are highlighted and come up as &ldquo;Not Verified&rdquo; in the Publisher field, then the driver does not have a digital signature.</li>
</ol>
<p>Drivers that are &ldquo;Not Verified&rdquo; do not have a digital signature or&nbsp;have been modified. It doesn&rsquo;t mean that the driver is malware. It just means that the driver cannot be verified to be from the publisher that is claims to be from. For example, the driver might have been written by a small company that didn&rsquo;t bother to have their driver signed.</p>
<p><strong>Note:</strong> 64-bit versions of Windows and Windows Server require all drivers to be signed when loaded, but this policy can be&nbsp;by-passed.</p>
<p>With that said, malware commonly installs a driver to gain access to the system and it could be exposed through this procedure. My advice is if the system is not functioning properly, then I would uninstall the unverified drivers.</p>
<p>Beyond driver validation, Autoruns is great for fixing performance issues as well. I simply go to all of the other tabs and uncheck/disable all of the software that I don&rsquo;t recognize. Be careful when doing this and disable only the entries that you recognize and don&rsquo;t want. If you accidentally disable something that you need, then its okay because Autoruns makes a backup of the entry and it can be re-enabled by running the tool again.</p>
<p>I hope you find this helpful.</p>]]></content:encoded>
    </item>
    <item>
      <title>Convert a performance counter data collector template into a PAL threshold file</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/convert-a-performance-counter-data-collector-template-into-a-pal-threshold-file</link>
      <pubDate>Mon, 18 Nov 2013 22:19:48 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/11/18/convert-a-performance-counter-data-collector-template-into-a-pal-threshold-file/</guid>
      <description><![CDATA[If you want to have all of the counters in a counter log be represented in a PAL report, then use...]]></description>
      <content:encoded><![CDATA[<p>If you want to have all of the counters in a counter log be represented in a PAL report, then use the AllCounterStats feature in the PAL Wizard. This will use all of the thresholds in the PAL threshold files as well as ensure that all of the counters are in the report at Stats Only.</p>  <p>With that said, if you deal with many unique counter and don’t want to create your own threshold file yet, then consider using the script discussed in this blog entry as a starting point.</p>  <p>Due to popular demand, I created a Powershell script that will convert a performance counter data collector template into a <a href="https://pal.codeplex.com" target="_blank">PAL</a> threshold file. The script is called a non-imaginative PerfmonTemplateToPalThresholdFile.ps1. Be forewarned that the threshold file produced from this will not have any thresholds in it.</p>  <p>For now, I consider it to be beta, so it can be downloaded from:</p>  <p><a href="https://aka.ms/clinth">https://aka.ms/clinth</a>, then go to PAL/BetaTesting</p>  <p>or</p>  <p><a title="https://skydrive.live.com/?cid=e6360c54b48a891b&amp;id=E6360C54B48A891B%21428&amp;authkey=!APQbXtD8U-HExzE#cid=E6360C54B48A891B&amp;id=E6360C54B48A891B%215119&amp;authkey=%21APQbXtD8U-HExzE" href="https://skydrive.live.com/?cid=e6360c54b48a891b&amp;id=E6360C54B48A891B%21428&amp;authkey=!APQbXtD8U-HExzE#cid=E6360C54B48A891B&amp;id=E6360C54B48A891B%215119&amp;authkey=%21APQbXtD8U-HExzE">https://skydrive.live.com/?cid=e6360c54b48a891b&amp;id=E6360C54B48A891B%21428&amp;authkey=!APQbXtD8U-HExzE#cid=E6360C54B48A891B&amp;id=E6360C54B48A891B%215119&amp;authkey=%21APQbXtD8U-HExzE</a>&#160;</p>  <p>In a few weeks or so, I will include it with the PAL tool – likely v2.4.1.</p>  <h3>How to use it</h3>  <ol>   <li>Ensure Powershell is set to unrestricted – WARNING this can be a potential security risk</li>    <ol>     <li>At an administrator Powershell session run: Set-ExecutionPolicy unrestricted</li>   </ol>    <li>Place a performance counter data collector template file (it must be in XML format) in the same directory as the script.</li>    <li>Unblock the script file. Files downloaded from the internet are considered high risk, so go to the properties of the script file and click the Unblock button. Otherwise, the script will not be permitted to run.</li>    <li>Run the script</li>    <ol>     <li>Start a Powershell session and change directory to the script location.</li>      <li>.\PerfmonTemplateToPalThresholdFile –PerfMonTemplate .\SysTemplate.xml</li>      <li>A PAL threshold file will be created in the same directory. It will use the DataCollector Name attribute in the template file as the file name.</li>   </ol>    <li>Copy the PAL threshold file to the PAL installation directory</li>    <ol>     <li>Once the PAL threshold file is created, copy it to the PAL installation directory.</li>      <li>Run the PAL Wizard and you should see the file in the list of threshold files.</li>   </ol> </ol>  <h3></h3>  <h3>Considerations</h3>  <ul>   <li>This script is designed for PAL v2.0 and later.</li>    <li>The PAL threshold file produced will only create statistics only – no thresholds.</li>    <li>If you goal is to have all of the counters in a counter log to be represented in the PAL report, then use the AllCounterStats feature.</li> </ul>]]></content:encoded>
    </item>
    <item>
      <title>Tracking page file reads and writes</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/tracking-page-file-reads-and-writes</link>
      <pubDate>Wed, 16 Oct 2013 19:35:22 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/10/16/tracking-page-file-reads-and-writes/</guid>
      <description><![CDATA[&#160;  The only real way of knowing if a page file is actually being “read from” is to get a file...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>The only real way of knowing if a page file is actually being “read from” is to get a file IO trace. This can be collected and/or viewed with tools such as the Microsoft Performance Recorder/Analyzer, Microsoft Resource Monitor, or Sysinternals Process Monitor.</p>  <p></p>  <h3>Using Resource Monitor</h3>  <p>Resource Monitor is built into the operating system and can be launched from the Performance tab of Task Manager. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3463.image_27D6F156.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3463.image_5F00_27D6F156.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/7266.image_thumb_75731DD6.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/7266.image_5F00_thumb_5F00_75731DD6.png" width="244" height="101" /></a> </p>  <p><strong>The Disk Activity pane in Microsoft Resource showing reads and writes to pagefile.sys.</strong></p>  <p>The Disk tab shows the processes and files involved in live disk activity. This data comes from Event Tracing for Windows (ETW) and shows much more data than what performance counters can provide. In this case, we can see the file C:\pagefile.sys being written to by the System process. </p>  <p></p>  <h3>Using Windows Performance Recorder/Analyzer</h3>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3060.image_353D045C.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3060.image_5F00_353D045C.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/6082.image_thumb_7506EAE1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/6082.image_5F00_thumb_5F00_7506EAE1.png" width="244" height="193" /></a> </p>  <p>Microsoft Windows Performance Recorder/Analyzer is part of the free Windows Assessment and Deployment Kit (ADK) and can capture activity related to hard page faults and the processes and files associated with them. In this case, I used WPR to record Disk IO and File IO activity while forcing the system to use the page file. In the screenshot I am showing the Hard Faults chart within Windows Performance Analyzer (WPA) and I aggregated the data to show the files most involved with hard page faults and in this case it was C:\pagefile.sys. This is proof that most of the hard page fault activity was related to the page file in this case.</p>  <p></p>  <h3>Using Sysinternals Process Monitor</h3>  <p>Sysinternals Process Monitor (Procmon) can also show page file reads and writes. This can be done by enabling the <strong>Advanced Output</strong> option under Filter, Enable Advanced Output. Once enabled, set the filter to only show events where “Path is C:\pagefile.sys” or similar for other page files.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/8171.image_62BE241F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/8171.image_5F00_62BE241F.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3884.image_thumb_37798D18.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3884.image_5F00_thumb_5F00_37798D18.png" width="244" height="151" /></a> </p>  <p>After capturing data for a few minutes, click Tools, File Summary to get more details of the number of reads and writes to the page file.</p>  <p></p>  <h3>Hard page fault related performance counters</h3>  <p>The performance counters <strong>\Memory\Page/sec</strong>, <strong>\Memory\Page Reads/sec</strong>, and <strong>\Memory\Page Inputs/sec</strong> measure hard page faults (faults that must be resolved by disk) which <strong>*may*</strong> or <strong>*may not*</strong> be related to a page file or a low physical memory condition. Hard page faults are a normal function of the operating system and happen when reading the portions of image files (DLLs and EXEs) as they are needed, when reading memory mapped files, or when reading from a page file. High values for these counters (excessive paging) indicate disk access (generally 4 KB per page fault on x86 and x64 versions of Windows and Windows Server), but again, they may or may not be related to page file activity, but they contribute towards disk usage which can increase the likelihood of system-wide delays assuming the related disk(s) are overwhelmed. Therefore, it is recommended to monitor the disk performance of the logical disks hosting a page file in correlation with these counters. </p>  <p><strong>Note: \Memory\Page Writes/sec</strong> and <strong>\Memory\Page Output/sec</strong> do measure only page file writes.</p>  <p>In addition, the counter <strong>\Paging File(*)\% Usage</strong> provides us the usage, but not how often a page file is actually being accessed. In addition, hard page faults just mean disk access. </p>  <p>This is the reason why the Performance Analysis of Logs (<a href="https://pal.codeplex.com/" target="_blank">PAL</a>) tool measures a low memory condition that could cause system wide delays by taking many performance counters into consideration. The PAL tool has an analysis called Physical Memory Overwhelmed and creates a factious counter called <strong>\Memory\Physical Memory Overwhelmed</strong>. In this analysis, it analyzes for low physical memory (<strong>\Memory\Available MBytes</strong>), page file usage (<strong>\Paging File(*)\% Usage</strong>), and disk counters related to the page file(s) to determine if they are overwhelmed when the system is low on physical memory.</p>]]></content:encoded>
    </item>
    <item>
      <title>Full debugging of VBScripts using Visual Studio 2005</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/full-debugging-of-vbscripts-using-visual-studio-2005</link>
      <pubDate>Mon, 30 Sep 2013 12:06:22 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/09/30/full-debugging-of-vbscripts-using-visual-studio-2005/</guid>
      <description><![CDATA[Want to do *full* debugging of a VBScripts, then use this procedure.  One of the hardest parts about...]]></description>
      <content:encoded><![CDATA[<p>Want to do *full* debugging of a VBScripts, then use this procedure.</p>  <p>One of the hardest parts about scripting is getting to know the properties and methods of objects and state of a script during execution.&#160; In this procedure, I show you how to modify Microsoft Visual Studio 2005 for full debugging of VBScripts. I have used this procedure for many years starting with Windows XP. This time, I recently did this on Windows 8.1.</p>  <h2>Install and run Visual Studio 2005</h2>  <p>Yes, it must be a full version of Microsoft Visual Studio 2005 (Express editions do not work) and it can’t be older or a newer version of Visual Studio, so break out that old archive of software and install it.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/5460.image_545FF95A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/5460.image_5F00_545FF95A.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/1263.image_thumb_6F98525B.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/1263.image_5F00_thumb_5F00_6F98525B.png" width="244" height="187" /></a> </p>  <p>During installation, the only option that is needed is “Visual Basic”. In my case, I cleared all other checkboxes and only checked Visual Basic. Then finish the installation wizard.</p>  <p>On Windows 8.1, I had to install an older version of the Microsoft .NET Framework and run Visual Studio 2005 with Administrator rights in order for it to create some starting folders and files.</p>  <h2>Configure Visual Studio 2005</h2>  <p>Once Visual Studio 2005 is installed, you can immediately run your scripts through the Visual Studio 2005 debugger by using the “//X” argument in CScript.exe or WScript.exe. This prompts the scripting engine for a debugger. I will show how to do this later. In the meantime, let’s configure Visual Studio 2005 a bit more to make it better suited for VBScript execution and editing.</p>  <p>Visual Studio will look like this initially.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/1856.image_1666689C.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/1856.image_5F00_1666689C.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/4503.image_thumb_1D19721F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/4503.image_5F00_thumb_5F00_1D19721F.png" width="244" height="204" /></a> </p>  <p>In the menu, click Tools, External Tools.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/0702.image_43E7885F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/0702.image_5F00_43E7885F.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3438.image_thumb_51B9CE5A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3438.image_5F00_thumb_5F00_51B9CE5A.png" width="244" height="239" /></a> </p>  <p>Optionally, delete the “Dot&amp;fuscator Community Edition” entry. In my case, I removed it.</p>  <p></p>  <h3>For CScript execution</h3>  <p>Click Add and set the fields to these values:</p>  <table cellspacing="0" cellpadding="2" width="400" border="1"><tbody>     <tr>       <td valign="top" width="201"><font size="3"><strong>Field</strong></font></td>        <td valign="top" width="197"><font size="3"><strong>Comment</strong></font></td>     </tr>      <tr>       <td valign="top" width="201"><strong>Title:</strong> CScript</td>        <td valign="top" width="197">This can be any title that you want.</td>     </tr>      <tr>       <td valign="top" width="201"><strong>Command:</strong> C:\Windows\System32\cscript.exe</td>        <td valign="top" width="197">This must be the path to the Windows installation directory and point to cscript.exe.</td>     </tr>      <tr>       <td valign="top" width="201"><strong>Arguments:</strong> //nologo $(ItemPath)</td>        <td valign="top" width="197">Click the right-arrow button and select “Item Path”. Optionally use the “//nologo” argument so that the CScript logo information will not be part of the output during script execution.</td>     </tr>      <tr>       <td valign="top" width="201"><strong>Initial directory:</strong> $(ItemDir)</td>        <td valign="top" width="197">Click the right-arrow button and click “Item Directory”.</td>     </tr>      <tr>       <td valign="top" width="201"><strong>Use Output Window:</strong> [checked]</td>        <td valign="top" width="197">Enable Use Output window. This will have the VBScript output go to the output window in Visual Studio</td>     </tr>   </tbody></table>  <p>Leave all other entries at default settings and Click Apply.</p>  <p><strong>Note:</strong> Optionally, use WScript in the command path if you want to have WScript.exe as the VBScript execution engine.</p>  <p></p>  <h3>For CScript debugging</h3>  <p>Click Add and set the fields to these values:</p>  <table cellspacing="0" cellpadding="2" width="441" border="1"><tbody>     <tr>       <td valign="top" width="235"><font size="3"><strong>Field</strong></font></td>        <td valign="top" width="204"><font size="3"><strong>Comment</strong></font></td>     </tr>      <tr>       <td valign="top" width="235"><strong>Title:</strong> CScript Debug</td>        <td valign="top" width="204">This can be any title that you want.</td>     </tr>      <tr>       <td valign="top" width="235"><strong>Command:</strong> C:\Windows\System32\cscript.exe</td>        <td valign="top" width="204">This must be the path to the Windows installation directory and point to cscript.exe.</td>     </tr>      <tr>       <td valign="top" width="235"><strong>Arguments:</strong> //nologo //X $(ItemPath)</td>        <td valign="top" width="204">Click the right-arrow button and select “Item Path”. The “//X” argument is a CScript argument that tells the engine to prompt for a debugger. Optionally use the “//nologo” argument so that the CScript logo information will not be part of the output during script execution.</td>     </tr>      <tr>       <td valign="top" width="235"><strong>Initial directory:</strong> $(ItemDir)</td>        <td valign="top" width="204">Click the right-arrow button and click “Item Directory”.</td>     </tr>      <tr>       <td valign="top" width="235"><strong>Use Output Window:</strong> [checked]</td>        <td valign="top" width="204">Enable Use Output window. This will have the VBScript output go to the output window in Visual Studio</td>     </tr>   </tbody></table>  <p>Leave all other entries at default settings and Click Apply.</p>  <p><strong>Note:</strong> If you want to prompt for arguments to the script before execution, then check the “Prompt for arguments” check box.</p>  <p>Click OK on the “External Tools” dialog box when finished adding entries.</p>  <p></p>  <h3>Add the scripting buttons to the toolbar</h3>  <p>Right-click the Visual Studio 2005 toolbar (the bar with File, Edit, View, and so on) and then click Customize. Click the Commands tab and select Tools from the Categories menu. In the Commands menu, scroll down until you find “External Command 1”. Click, hold, and drag “External Command 1” to the menu bar of Visual Studio 2005. You can put it anywhere you want.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/2451.image_7887E49A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/2451.image_5F00_7887E49A.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/8712.image_thumb_7168A822.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/8712.image_5F00_thumb_5F00_7168A822.png" width="244" height="190" /></a> </p>  <p><strong>Note:</strong> The button will initially show up as “External Command 1”, but will change to the external command title we provided earlier once the toolbar Customize dialog box is closed.</p>  <p>Repeat this for all of the entries in the External Command window that you created earlier such as “External Command 2” and “External Command 3” and so on. Click Close on the Customize dialog box when finished.</p>  <p>In my case, CScript and CScript Debug show up on my toolbar.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/1200.image_4624111B.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/1200.image_5F00_4624111B.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/2388.image_thumb_45B7DE26.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/2388.image_5F00_thumb_5F00_45B7DE26.png" width="244" height="144" /></a> </p>  <p></p>  <h3>Show line numbers</h3>  <p>When a VBScript throws an error, it provides the line number and character number of where the error occurred. For this reason, it is convenient to have the line numbers shown when editing the scripts.</p>  <p>Click Tools and select Options. The Options dialog box will show. Check “Show all settings”.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/2308.image_1A73471F.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/2308.image_5F00_1A73471F.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/4035.image_thumb_60F03727.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/4035.image_5F00_thumb_5F00_60F03727.png" width="244" height="142" /></a> </p>  <p>In the tree view control on the left, navigate to Text Editor and select All Languages. Check “Line numbers” on the right and then click OK.</p>  <p></p>  <h2>Executing VBScripts in Visual Studio 2005</h2>  <p>To open a script within Visual Studio 2005, simply right-click on the script, and Open with Visual Studio 2005. In this case, I opened up test.vbs.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/7510.image_07BE4D68.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/7510.image_5F00_07BE4D68.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/7026.image_thumb_51502C16.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/7026.image_5F00_thumb_5F00_51502C16.png" width="244" height="224" /></a> </p>  <p>To execute the script, I just click the CScript button. In my case, my script output automatically showed the output in the Output window below.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/2728.image_22F6A669.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/2728.image_5F00_22F6A669.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/8611.image_thumb_77B20F61.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/8611.image_5F00_thumb_5F00_77B20F61.png" width="244" height="224" /></a> </p>  <p></p>  <h2>Debugging VBScript in Visual Studio 2005</h2>  <p>Now for the best part! Debugging the script. When a script loaded into Visual Studio 2005, click the CScript Debug button (or whatever you named it). If it throws an error of not able to find the script, then click anywhere in the script editor pane and try it again. The script has to have the focus.</p>  <p>When the debugger starts, it prompts if you want to debug the script from within the same instance of Visual Studio or a new instance of Visual Studio. Choose the existing instance of Visual Studio especially if you already have break points set. Then click the Yes button.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/1185.image_0C375EE0.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/1185.image_5F00_0C375EE0.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/7446.image_thumb_40D7BB1B.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/7446.image_5F00_thumb_5F00_40D7BB1B.png" width="224" height="244" /></a> </p>  <p>This starts off the script in the debugger and it stops at the first line of code. The yellow arrow and highlight indicate the line of execution.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/0118.image_67A5D15B.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/0118.image_5F00_67A5D15B.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3755.image_thumb_00356EAC.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3755.image_5F00_thumb_5F00_00356EAC.png" width="244" height="224" /></a> </p>  <p>At this point, you can do debugging as you normally would in Visual Studio such as setting break points, run to cursor, show locals, have a watch window and so on. Use the commands in the Debug menu and/or Debug icons to debug the script.</p>  <h3>Showing the output when debugging</h3>  <p>A quirk of the debugger is that you have to add the output window again by clicking on down arrow of the icon of a window with a red sphere, then selecting Output. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/4834.image_54F0D7A4.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/4834.image_5F00_54F0D7A4.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/7571.image_thumb_7BBEEDE4.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/7571.image_5F00_thumb_5F00_7BBEEDE4.png" width="156" height="244" /></a> </p>  <p>Change the output window to the debug output.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/2287.image_507A56DD.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/2287.image_5F00_507A56DD.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/0552.image_thumb_16F746E6.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/0552.image_5F00_thumb_5F00_16F746E6.png" width="244" height="223" /></a> </p>  <p>Now, you should see the WScript.echo output from the script when debugging.</p>  <p></p>  <h3>Using Locals and/or the Watch window</h3>  <p>I like looking at the variables of my scripts using the Locals and Watch windows. While in the script is paused in the debugger, click the “Watch 1” icon in the Visual Studio tool bar. This will replace the Output window with the Watch 1 window.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/5355.image_6BB2AFDE.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/5355.image_5F00_6BB2AFDE.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/7002.image_thumb_2B7C9664.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/7002.image_5F00_thumb_5F00_2B7C9664.png" width="244" height="224" /></a> </p>  <p>In this case, I can select variable “b” and drag it to the Watch Window.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/3704.image_245D59EC.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/3704.image_5F00_245D59EC.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/73/metablogapi/5751.image_thumb_1214932A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-73-metablogapi/5751.image_5F00_thumb_5F00_1214932A.png" width="244" height="224" /></a> </p>  <p>I can do this with any variable or object within a script. This technique is especially helpful with objects and arrays because the Watch window allows you to explore the it and see the values.</p>  <p><strong>Note:</strong> You cannot edit the script while it is running in the debugger and the script must be saved in order to run what you are seeing in the editor.</p>  <p></p>  <h2>Intellisense and quirks</h2>  <p>Visual Studio tries to provide “intellisense” to objects, so that you can just type an object instance name and type, “.” to have it provide you with the properties and methods of the object. Unfortunately, Visual Studio 2005 only provides intellisense for a few of the VBScript objects. Also, please understand that Visual Studio 2005 actually thinks that the VBScript is VB.NET code, so there will be a few inconsistencies. </p>  <p>Also, remember that the debug output has to be enabled. See “Showing the output when debugging” discussed earlier.</p>  <p>For a richer intellisense experience with VBScript editing, consider third party tools such as Sapien Technologies <a href="https://www.sapien.com/software/primalscript" target="_blank">Primal Script</a>.</p>  <p></p>  <h2>Conclusion</h2>  <p>There are certainly other editors out there for debugging VBScripts, but this one seems to be the easiest and richest experience in regards to VBScript debugging. I’ve used this technique for years for my own VBScripting needs and to teach students the basics of VBScripting. I hope you find this useful.</p>]]></content:encoded>
    </item>
    <item>
      <title>Out of Pool Paged memory on 32-bit Windows Server 2003</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/out-of-pool-paged-memory-on-32-bit-windows-server-2003</link>
      <pubDate>Mon, 23 Sep 2013 11:59:56 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/09/23/out-of-pool-paged-memory-on-32-bit-windows-server-2003/</guid>
      <description><![CDATA[Lately, I have been assisting customers who are still using 32-bit Windows Server 2003 and...]]></description>
      <content:encoded><![CDATA[<p>Lately, I have been assisting customers who are still using 32-bit Windows Server 2003 and inevitably running out of kernel pool memory. When one of the kernel pools (Pool Paged and Pool Nonpaged) are full (meaning a memory allocation to one of these pools fails due to a lack of free space), then applications or even the system might hang or malfunction, so this is a serious consideration. In any case, the primary problem here is 32-bits.</p>  <p>The largest number that can be represented by 32-bit is 4 GB. That 4 GB is divided into user mode (process memory) and kernel mode. By default, this gives the kernel 2 GB to work with. The kernel memory is then divided further into a Page Frame Number (PFN) database, Pool Paged, Pool Nonpaged, and the rest of the free memory is given to Free System Page Table Entries (PTEs). In Windows Server 2003, Pool Paged and Pool Nonpaged have a specific size. This means that the system can run out of either pool and hang when there is still plenty of free kernel virtual memory elsewhere. This is why 32-bit versions of Windows Vista and Windows Server 2008 and later allow the full kernel virtual address space to be used. </p>  <p>Instead of me going into all of the complexities of how to detect this problem and how to troubleshoot it, I will just go into these recommendations if you suspect the system it out of kernel pool memory.</p>  <ol>   <li><strong>Migrate to 64-bit Windows Server:</strong> 64-bit has 8 TB of virtual address space for kernel memory which will effectively solve this issue, but I realize that it might be difficult to go to 64-bit Windows Server. All drivers on a 64-bit version of Windows Server must be 64-bit, but 32-bit applications can run on 64-bit Windows Server.</li>    <li><strong>Upgrade to 32-bit Windows Server 2008:</strong> If it is impossible to go to a 64-bit version of Windows Server, then at the very least consider upgrading to 32-bit Windows Server 2008. This version of Windows Server allow Pool Paged and Pool NonPaged to expand to up to just less than 2 GB assuming there is more than 2 GB of physical memory installed – Pool NonPaged’s maximum is 75% of physical memory (RAM).</li>    <li><strong>Disable Dynamic Memory (hot-add):</strong> If the physical system has the capability to add more physical memory (RAM) to the system, then the Page Frame Number (PFN) database in Windows is likely larger than needed. To reduce the PFN database to a smaller size, set the DynamicMemory registry key to 1 which means 1 GB. The system realizes it is too small and resets it to the actual memory installed. This will likely increase the size of Pool Paged Bytes by 100 MB which could make the Pool Paged size to 169 MB.      <br /> How to Configure the Paged Address Pool and System Page Table Entry Memory Areas      <br /><a href="https://support.microsoft.com/kb/247904">https://support.microsoft.com/kb/247904</a>       <br /> The DynamicMemory registry key is located under the following registry key:      <br /> HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management</li>    <li><strong>View the actual amount of Pool Paged maximum size:</strong> Use Process Explorer with the Debugging Tools for Windows (point Process Explorer to the dbghelp.dll file that comes with the Debugging Tools for Windows) and a symbol path of “SRV*C:\Symbols*https://msdl.microsoft.com/download/symbols” (internet access required) to see the maximum size of the kernel pool paged.</li>    <li><strong>Look for kernel insufficient memory events:</strong> In the System event logs, look for Event ID 2019 and 2020 messages. If the system has these events, then it indicates that the system ran out of kernel virtual memory.</li>    <li><strong>Consider adjusting PoolPagedSize with CAUTION:</strong> Be *very* careful with this!!! The <a href="https://technet.microsoft.com/en-us/library/cc976157.aspx">PoolPagedSize</a> registry key (see the link for more information) can be set to a larger amount than what it is, *but* this will take away from the System PTEs and your system is borderline for running out of those as well. Only do this if a Microsoft Support Professional has recommended this.</li>    <li><strong>Use Poolmon.exe:</strong> If the pool paged memory usage is too much, then use Poolmon.exe to identify which drivers are consuming the most. The download and usage of Poolmon is described in this blog entry by Mark Russinovich (author of the Windows Internals book and creator of the Sysinternals tools).      <br /> Mark Russinovich’s blog entry on Windows pool memory troubleshooting:      <br /><a href="https://blogs.technet.com/b/markrussinovich/archive/2009/03/26/3211216.aspx?wa=wsignin1.0">https://blogs.technet.com/b/markrussinovich/archive/2009/03/26/3211216.aspx?wa=wsignin1.0</a>.      <br /></li> </ol>]]></content:encoded>
    </item>
    <item>
      <title>My personal reminder of common debugging commands</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/my-personal-reminder-of-common-debugging-commands</link>
      <pubDate>Thu, 15 Aug 2013 14:20:47 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/08/15/my-personal-reminder-of-common-debugging-commands/</guid>
      <description><![CDATA[I don’t get as many opportunities to debug as I would like, but when I do, I always forget the...]]></description>
      <content:encoded><![CDATA[I don’t get as many opportunities to debug as I would like, but when I do, I always forget the command that I like to use, so this is my personal document to remind me of those commands.

<strong>!sym noisy</strong>

This gives me details of symbol resolution.

<strong>.reload /f</strong>

This forces all of the symbols to be downloaded. Great for packaging the symbols to take to a location that doesn’t have internet access.

<strong>~*kb</strong>

This enumerates all of the native thread stacks.

<strong>!threads</strong>

A summary of all of the threads.

<strong>.load C:\Users\clinth\Desktop\psscor2\psscor2\amd64\psscor2.dll</strong>

This loads the PSSCOR2 debugger extension for debugging .NET applications.

<strong>~*e!clrstack</strong>

Once the PSSCOR2 extension is loaded, this command enumerates the managed .NET call stack of all of the threads.

<strong>!process 0 0</strong>

Lists all processes in a kernel dump.]]></content:encoded>
    </item>
    <item>
      <title>Detecting ephemeral port exhaustion</title>
      <link>https://docs.microsoft.com/archive/blogs/clinth/detecting-ephemeral-port-exhaustion</link>
      <pubDate>Fri, 09 Aug 2013 13:19:37 GMT</pubDate>
      <dc:creator><![CDATA[Clint Huffman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/clinth/2013/08/09/detecting-ephemeral-port-exhaustion/</guid>
      <description><![CDATA[Symptoms

When Windows or Windows Server is out of ephemeral/outbound/dynamic network ports, it...]]></description>
      <content:encoded><![CDATA[<strong>Symptoms</strong>

When Windows or Windows Server is out of ephemeral/outbound/dynamic network ports, it will not be able to establish any outbound network connections. This results in a lot of connection failures such as database and/or domain controller connections. If the system is not responding, then try increasing the port range (discussed below) - this change is effective immediately. If the system immediately recovers, then you know you are dealing with this issue. You can either increase the port range which may just delay the problem or you can try to identify the cause.

<strong>Detecting user mode port leaks</strong>

Ephemeral ports are range of ports that Windows and Windows Server use for outbound communications over the TCP/IP network protocol. When an outbound connection is finished, the port associated to the connection is put into a TIMED_WAIT state for two minutes by default. This allows any lingering packets on the network to be ignored. Windows Server 2008 and later use the IANA range which uses the ports between 49152 and 65535 providing 16,383 ports.

Some applications and services such as Microsoft Exchange Server CAS servers can be very “chatty” and might actually use all 16,383 ports within a two minute time period. The result is connection failures similar to “Couldn’t connect to X, due to no ports available from the end point mapper”.

If you suspect ephemeral port exhaustion, then consider running the following Powershell script called “Log-EphemeralPortStats.ps1” at
<a href="https://1drv.ms/f/s!AhuJirRUDDbmkotkPocbTrN0wgKB7Q">https://1drv.ms/f/s!AhuJirRUDDbmkotkPocbTrN0wgKB7Q</a>

Warning: This script is provided as sample code only. Please review it and use at your own risk.

Be aware that this only detects user mode port leaks. If a driver (kernel mode) is leaking ports, then a complete memory dump must be sent to Microsoft Support for analysis to know which driver is responsible. The memory dump must be taken when the system has leaked a significant number of ports.

This script is designed to run in an infinite loop of 1 minute sleep intervals and write to a log file called “EphemeralPortStats.log”. Here is an example of the output it produces:

<span style="font-family: Courier New;font-size: xx-small">Computer       DateTime             LocalAddress  #OfEPortsInUse Max#OfEPorts %EPortUsage #OfTcpListeningPorts #OfPids
--------       --------             ------------  -------------- ------------ ----------- -------------------- -------
ETCHEDCHAMPION 8/9/2013 12:37:42 PM 127.0.0.1                  6        16384           0                   15      11
ETCHEDCHAMPION 8/9/2013 12:37:42 PM 172.18.96.192              3        16384           0                   15      10
ETCHEDCHAMPION 8/9/2013 12:37:42 PM 192.168.1.2               69        16384         0.4                   15      17</span>

This script is intended to be ran from the console of the computer suspected to be running low on ephemeral ports and to leave it running. Periodically review the log to see if there was any ephemeral port exhaustion detected.

This script gets the port range from:

netsh int ipv4 show dynamicportrange tcp

Then, correlates this information with the output of:

netstat –ano –p tcp

PsExec can be potentially used to get this information from remote computers, but keep in mind that passwords used in PsExec are sent in the clear over the network.

My PFE colleagues and customers have used this script quit a bit and I hope it will help you as well.

Also, as a temporary work-around, the ephemeral/dynamic/outbound port range can be increased using the following command:

netsh int ipv4 set dynamicport tcp start=10000 num=55535

This change takes affect immediately. No need to restart. No need to reboot. This is about three times larger than the default. If this change has a positive affect when the problem occurs, then you know that this is the issue your system is dealing with.

To set the port range back to default, use the following command:

netsh int ipv4 set dynamicport tcp start=49152 num=16384

To check the port range:

netsh int ipv4 show dynamicportrange tcp

Once you have identify the process consuming the ports, contact the developer of the process for a fix.

Also, consider decreasing the TIMED WAIT delay using the TcpTimedWaitDelay registry key.

<strong>Detecting kernel mode port leaks</strong>

All of the above covers user mode port leaks - meaning leaks originating from processes. If a driver (kernel mode) leaks a port, then netstat will not be able to report it. Kernel mode port leaks can only be detected by inducing a complete memory dump and then analyzing the dump with the <a href="https://blogs.msdn.microsoft.com/luisdem/2016/07/19/mex-debugging-extension-for-windbg-2/">MEX debug extension</a>. Load MEX into WinDBG and then run the following commands to help identify ports associated with drivers.

!mex.afd -conn -report -verbose

!afd -endp -report

!tcpip -p

Once you identify the driver consumer the ports, contact the developer of the driver.

If you suspect a Windows Server 2008 R2 system might be running out of ephemeral ports, then apply the following hotfix:

<strong>Kernel sockets leak on a multiprocessor computer that is running Windows Server 2008 R2 or Windows 7</strong>
https://support.microsoft.com/en-us/kb/2577795

Windows Server 2012 and later are already patched with this fix.

UPDATE

Windows 10 and Windows Server 2012 R2 introduced the "q" parameter in netstat. This parameter displays all connections, listening ports, and bound non-listening TCP ports. Bound non-listening ports may or may not be associated with an active connection.]]></content:encoded>
    </item>
  </channel>
</rss>