<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tinyint.com &#187; Powershell</title>
	<atom:link href="http://www.tinyint.com/index.php/category/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tinyint.com</link>
	<description>An engineering and development &#60;em&#62;Factory of Knowledge&#60;/em&#62;™</description>
	<lastBuildDate>Fri, 23 Sep 2011 05:39:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Get an MD5 or SHA1 Checksum with PowerShell</title>
		<link>http://www.tinyint.com/index.php/2011/09/14/get-an-md5-or-sha1-checksum-with-powershell/</link>
		<comments>http://www.tinyint.com/index.php/2011/09/14/get-an-md5-or-sha1-checksum-with-powershell/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 08:04:26 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[checksum]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[sha1]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=288</guid>
		<description><![CDATA[I was excited about the Windows 8 developer preview that was released earlier tonight, so I fired up Virtual PC to start playing around with it.&#160; I ended up with an error when it was loading so I thought maybe I had a bad copy of the ISO so I thought &#34;I know, I&#39;ll do [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tinyint.com/wp-content/uploads/2011/09/get-checksum.png" rel="" target="" title=""><img alt="" class="alignnone size-full wp-image-297" height="271" src="http://www.tinyint.com/wp-content/uploads/2011/09/get-checksum.png" style="border: 0px currentColor;" title="get-checksum" width="600" /></a></p>
<p>I was excited about the <a href="http://msdn.microsoft.com/en-us/windows/apps/br229516">Windows 8 developer preview</a> that was released earlier tonight, so I fired up Virtual PC to start playing around with it.&nbsp; I ended up with an error when it was loading so I thought maybe I had a bad copy of the ISO so I thought &quot;I know, I&#39;ll do a&nbsp;checksum test.&quot;&nbsp; Unfortunately, I don&#39;t have a tool to take a checksum on my current machine so naturally I wrote a simple function in PowerShell to do the checksum test for me.</p>
<p>It has only a few simple parameters that you can enter, file and algorithm.&nbsp; &quot;File&quot; is for the actual file you want to checksum.&nbsp; &quot;Algorithm&quot; is either &quot;sha1&quot; or &quot;md5&quot; and will let you get both an MD5 and a SHA1 checksum of the specified file.</p>
<p>Update: If you came here looking for the SHA1/MD5 hashes for the Windows 8 CTP iso&#8217;s, here you go.</p>
<p><strong>Windows Developer Preview with developer tools English, 64-bit (x64)</strong><br/><strong>SHA1: </strong>6FE9352FB59F6D0789AF35D1001BD4E4E81E42AF<br /><strong>MD5: </strong>116EB08542BB48FE4314BB6DEA39335E</p>
<p><strong>Windows Developer Preview English, 64-bit (x64)</strong><br /><strong>SHA1: </strong>79DBF235FD49F5C1C8F8C04E24BDE6E1D04DA1E9<br /><strong>MD5: </strong>DFCB53C7B32351784C37E5DE0A7B1167</p>
<p><strong>Windows Developer Preview English, 32-bit (x86)</strong><br /><strong>SHA1: </strong>4E0698BBABE01ED27582C9FC16AD21C4422913CC<br /><strong>MD5: 9B7798438FA694ECFA465C93A4C23C97</strong></p>
<p>&nbsp;</p>
<p><em>You can download the full script after the jump.</em></p>
<p><span id="more-288"></span></p>
<p><pre class="brush: powershell; title: ; notranslate">
function Get-Checksum
{
    Param (
        [string]$File=$(throw(&quot;You must specify a filename to get the checksum of.&quot;)),
        [ValidateSet(&quot;sha1&quot;,&quot;md5&quot;)]
        [string]$Algorithm=&quot;sha1&quot;
    )

    $fs = new-object System.IO.FileStream $File, &quot;Open&quot;
    $algo = [type]&quot;System.Security.Cryptography.$Algorithm&quot;
	$crypto = $algo::Create()
    $hash = [BitConverter]::ToString($crypto.ComputeHash($fs)).Replace(&quot;-&quot;, &quot;&quot;)
    $fs.Close()
    $hash
}
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2011/09/14/get-an-md5-or-sha1-checksum-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Countdown Timer</title>
		<link>http://www.tinyint.com/index.php/2011/08/28/powershell-countdown-timer/</link>
		<comments>http://www.tinyint.com/index.php/2011/08/28/powershell-countdown-timer/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 01:38:52 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[countdown]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=266</guid>
		<description><![CDATA[&#160; As a Premier Field Engineer for Microsoft, I&#39;m often presenting workshops to classrooms of people on various technologies.&#160; During these workshops we take breaks and work on labs and it&#39;s nice to have some kind of countdown timer to show the attendees how much time is left in a break or until we begin [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;<a href="http://www.tinyint.com/wp-content/uploads/2011/08/display-countdown.png"><img alt="" class="alignnone size-full wp-image-267" src="http://www.tinyint.com/wp-content/uploads/2011/08/display-countdown.png" style="border-width: 0px; border-style: solid; width: 618px; height: 357px;" title="display-countdown" /></a></p>
<p>As a Premier Field Engineer for Microsoft, I&#39;m often presenting workshops to classrooms of people on various technologies.&nbsp; During these workshops we take breaks and work on labs and it&#39;s nice to have some kind of countdown timer to show the attendees how much time is left in a break or until we begin the next module for example.</p>
<p>Sysinternals has a very useful tool called <a href="http://technet.microsoft.com/en-us/sysinternals/bb897434 ">ZoomIt</a>&nbsp;which allows presenters to zoom in, draw, and even display a countdown timer on the screen.&nbsp; While this tool is well designed and is even used by many PFE&rsquo;s around the world, including myself, and while it includes useful features such as playing a sound when the timer has completed and even displaying a background image, it left me wanting more.&nbsp; I just wanted something basic that I could use when presenting PowerShell material that would allow me to simply specify a time and a message&#8230; <em>so I made my own.</em></p>
<p><em>Head after the jump to download the script.</em></p>
<p><span id="more-266"></span></p>
<p>I wrote a script that would allow me to display a popup countdown timer from within the PowerShell console.&nbsp; The script I wrote is provides two different countdown timers: one is very basic and just displays a simple two line countdown, the other is a bit more advanced and displays an &ldquo;F7 style&rdquo; popup window like in the screenshot above.&nbsp; It looks pretty nice even though you&#39;re still limited to the font size of your shell (I always have mine set high (12&#215;16) for projection screens anyway).&nbsp; You can use the built-in Windows magnifier to enlarge it even more if you really want.</p>
<p>Here are a few usage examples, but you can see everything by&nbsp;looking at the comment-based help by running&nbsp;<span style="font-family: courier new,courier,monospace;">get-help .\display-countdown.ps1 -full</span></p>
<p><strong>Usage examples:</strong></p>
<blockquote>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; EXAMPLE 1 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong></p>
<p><strong>C:\PS>.\display-countdown.ps1 -Minutes 15 -Message &quot;Time until break is over&quot;</strong></p>
<p><strong>This will display a simple text-based countdown that will expire 15 minutes from the time it was called, displaying the specified message as a header.</strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; EXAMPLE 2 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong></p>
<p><strong>C:\PS>.\display-countdown.ps1 -Until (get-date).AddHours(1) -Message &quot;Lunch break&quot; -Popup</strong></p>
<p><strong>This will display a countdown timer that will expire in one hour from the time it was called, displayed &quot;Lunch break&quot; as the caption.&nbsp; This example displays in the more user friendly popup mode.</strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; EXAMPLE 3 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong></p>
<p><strong>C:\PS>.\display-countdown.ps1 -Countdown ([TimeSpan]::FromMinutes(10)) -Message &quot;Bio Break&quot; -NoClear</strong></p>
<p><strong>This will display a simple text-based countdown that will expire 10 minutes from the time it was called, displaying &quot;Bio Break&quot; as the header.&nbsp; This call does not clear the screen of its contents before running.&nbsp;</strong></p>
</blockquote>
<p>&nbsp;</p>
<strong><a href="http://www.tinyint.com/wp-content/plugins/download-monitor/download.php?id=7"><img alt="Download display-countdown.ps1" border="0" src="/images/download.png" style="width: 48px; height: 48px; border-width: 0pt; border-style: solid; vertical-align: middle;" title="Download display-countdown.ps1" /><span style="font-size:14px;">Download display-countdown.ps1</span></a></strong><br /><br />
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2011/08/28/powershell-countdown-timer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escaping quotes in powershell.exe -command via command prompt</title>
		<link>http://www.tinyint.com/index.php/2011/04/20/escaping-quotes-in-powershell-exe-command-via-command-prompt/</link>
		<comments>http://www.tinyint.com/index.php/2011/04/20/escaping-quotes-in-powershell-exe-command-via-command-prompt/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 07:00:02 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=211</guid>
		<description><![CDATA[An interesting situation came up recently that involved having to execute a PowerShell script through the cmd.exe command prompt. It sounds pretty simple, after all you can simply run powershell.exe –file &#8220;&#60;path_to_script&#62;&#8221; and call it a day. That wasn&#8217;t the case here though because the –File parameter is only available in PowerShell V2 and this [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/cmd-no-escape.png" alt="" title="Command Line - No Escape Character" width="517" height="306" class="alignnone size-full wp-image-219" /></p>
<p>An interesting situation came up recently that involved having to execute a PowerShell script through the cmd.exe command prompt.  It sounds pretty simple, after all you can simply run powershell.exe –file &#8220;&lt;path_to_script&gt;&#8221; and call it a day.  That wasn&#8217;t the case here though because the –File parameter is only available in PowerShell V2 and this situation was dealing with V1.  The only option then is to use the -command argument of powershell.exe and to execute the necessary code.  This works great, but if you need to include a string with quotes, you may have some trouble.<br />
<span id="more-211"></span><br />
<em>Scroll to the end for the summary if you just want to see how to properly get quotes into your powershell.exe -command argument.</em></p>
<p>Within PowerShell, it is incredibly simple to execute a script (assuming your script is signed or you have the execution policy set appropriately).  There are a few gotchas that people get caught up on when they are starting out with PowerShell so I&#8217;ll quickly cover them first.</p>
<p>We want to execute the script, so we just provide the full path to the script and hit enter, right?</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/posh-no-quotes.png" title="PowerShell - No Quotes" width="517" height="306" class="alignnone size-full wp-image-216" /></p>
<p>That didn&#8217;t work because of the spaces in the path.  Ok, then we just proceed like we would in a command prompt and put the path in quotes, right?</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/posh-quotes.png" alt="" title="PowerShell - Quotes" width="517" height="306" class="alignnone size-full wp-image-223" /></p>
<p>Unfortunately that doesn&#8217;t work either because now you are just telling PowerShell &#8220;Hey, here is a string&#8221; and it simply spits it back out to you.  The correct procedure is to use the <a href="http://technet.microsoft.com/en-us/library/dd347588.aspx">Call operator</a> with the entire path in quotes and it should work out fine.</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/posh-operator.png" alt="" title="PowerShell - Call Operator" width="517" height="306" class="alignnone size-full wp-image-222" /></p>
<p>Then, if we want to use the <a href="http://technet.microsoft.com/en-us/library/dd347713.aspx">environment variable</a> for the program files directory, we can just do the following:</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/posh-environment.png" alt="" title="PowerShell - Environment Variable" width="517" height="306" class="alignnone size-full wp-image-221" /></p>
<p>Now that we know the proper command syntax, we need to switch over to a command prompt, since this script has to be executed from there.  We know that powershell.exe can accept a <a href="http://technet.microsoft.com/en-us/library/dd315276.aspx">–Command parameter</a> which should allow us to execute the same command we just figured out within the PowerShell prompt.</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/cmd-no-escape.png" alt="" title="Command Line - No Escape Character" width="517" height="306" class="alignnone size-full wp-image-219" /></p>
<p>That doesn&#8217;t work, but what exactly is going on here?  Based on the output of the error, we can see that the environment variable is being expanded appropriately, but it looks like everything past &#8220;script&#8221; is being interpreted as an additional parameter.  With this in mind, it seems like it&#8217;s a simple matter of having to escape the quotation marks around the path of the script to make sure it&#8217;s interpreted as a single value.  Because we are in a dos prompt though, the first thought might be to use a caret (^) to escape the quotes, which is something we <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true">do all the time in batch files</a>.</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/cmd-dos-escape.png" alt="" title="Command Line - DOS Escape Character (^ - Caret)" width="517" height="306" class="alignnone size-full wp-image-218" /></p>
<p>That doesn&#8217;t work either, but the error is slightly different this time.  Instead of the intended result of having a quotation mark, the quotes are actually dropped and the caret is inserted.  So clearly the caret didn&#8217;t help, so next we try the <a href="http://technet.microsoft.com/en-us/library/dd347662.aspx">PowerShell escape character</a>, the grave accent (`).  This may make more sense because the logic is that whatever is inside the outer quotes, gets passed into the PowerShell executable, then the rest of it gets interpreted. Therefore we need PowerShell to be aware of what we are doing.</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/cmd-psh-escape.png" alt="" title="Command Line - PowerShell Escape Character (` - Grave Accent)" width="517" height="306" class="alignnone size-full wp-image-220" /></p>
<p>Interestingly, the environment variable isn&#8217;t being expanded now; additionally the grave accent isn&#8217;t being passed at all.  It&#8217;s as if PowerShell is completely disregarding the text we are inputting.  </p>
<p>So what is actually going on here?  As it turns out, we aren&#8217;t dealing with an issue with choosing the right escape character for DOS, or the right escape character for PowerShell.  The problem is that we need to use an escape character that the PowerShell argument parser can understand.  The powershell.exe binary isn&#8217;t a batch file or powershell script, it is an actual compiled program and as such has to actually parse the arguments that are given to it.  With that in mind, we need to use the appropriate escape character, the backslash (\).</p>
<p><img src="http://www.tinyint.com/wp-content/uploads/2011/04/cmd-c-escape.png" alt="" title="Command Line - C Escape Character (\ - Back slash)" width="517" height="306" class="alignnone size-full wp-image-217" /></p>
<p><strong>So what is the conclusion here?</strong>  When trying to execute a command in PowerShell via the -Command argument of powershell.exe, be sure to escape your quotes with the C style back slash.  </p>
<p>This behavior is by design, there is no doubt there.  Ultimately, it all comes down to how the application (powershell.exe in our case) parses the command line arguments.  PowerShell handles it this way whereas another app could in theory have it&#8217;s own, completely made-up, set of escape characters for arguments that are enclosed in quotes.  While it may be confusing when trying to execute commands via the PowerShell binary, this actually is logical behavior when you think about it, and once you are aware of how it works, you will likely never forget.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2011/04/20/escaping-quotes-in-powershell-exe-command-via-command-prompt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CA certificate expiration monitoring</title>
		<link>http://www.tinyint.com/index.php/2010/08/09/ca-certificate-expiration-monitoring/</link>
		<comments>http://www.tinyint.com/index.php/2010/08/09/ca-certificate-expiration-monitoring/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 17:19:17 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[certificate services]]></category>
		<category><![CDATA[windows 2008]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=181</guid>
		<description><![CDATA[A reader sent me a message asking how to modify the original CA monitoring script I wrote back in November so that instead of monitoring the pending requests, it would send a message based on expiring certificates. The answer is just a modification to the certutil command that was used in the original script.  The new [...]]]></description>
			<content:encoded><![CDATA[<p>A reader sent me a message asking how to modify the <a href="http://www.tinyint.com/index.php/2009/11/24/certificate-authority-request-monitoring-with-powershell/">original CA monitoring script</a> I wrote back in November so that instead of monitoring the pending requests, it would send a message based on expiring certificates.  The answer is just a modification to the certutil command that was used in the original script.  The new script also allows you to specify the number of days advanced notification you are looking for, the default is 30 days.  Just keep in mind that if you run this script once a day, you will receive a notification every day until the certificate is either revoked/superseded or the certificate is passed the time period specified.  Of course this is all irrelevant if you have the money to spend on <a href="http://www.microsoft.com/systemcenter/en/us/operations-manager.aspx">SCOM</a> which can do this with one of the released <a href="http://www.microsoft.com/downloads/details.aspx?familyid=15edbfeb-0b7d-4baf-a7bd-6bb84a6b822d&amp;displaylang=en&amp;tm">management packs</a>.</p>
<p>The modified <a href="http://technet.microsoft.com/en-us/library/cc732443%28WS.10%29.aspx">certutil</a> command looks a bit like this:</p>
<pre class="brush: plain; title: ; notranslate">certutil -view -restrict &quot;NotAfter&gt;=8/9/2010,NotAfter&lt;=9/9/2010&quot; -out &quot;Request ID, Request Submission Date, Request Common Name, Requester Name, Request Email Address, Request Distinguished Name, CertificateTemplate, NotAfter&quot; -config &quot;&lt;CA_SERVER_NAME&gt;\&lt;CA_NAME&gt;&quot;</pre>
<p>This will return to you all of the certificates that are scheduled to expire between today (August 9th, 2010) and 30 days from now (September 9th, 2010)</p>
<p>You can download the new script here: <strong><a href="http://www.tinyint.com/wp-content/plugins/download-monitor/download.php?id=5"><img alt="Download monitor_ca_expiry.ps1" border="0" src="/images/download.png" style="width: 48px; height: 48px; border-width: 0pt; border-style: solid; vertical-align: middle;" title="Download monitor_ca_expiry.ps1" /><span style="font-size:14px;">Download monitor_ca_expiry.ps1</span></a></strong><br /><br /></p>
<p><strong>Update</strong>: Thanks to Aaron (from New Mexico? the original reader) who noticed I forgot one really useful bit of information from the status report that displays when you run the command: the date of expiration for the certificate.  I have updated the script and the sample above to reflect the change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2010/08/09/ca-certificate-expiration-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Certificate Authority Request Monitoring with Powershell</title>
		<link>http://www.tinyint.com/index.php/2009/11/24/certificate-authority-request-monitoring-with-powershell/</link>
		<comments>http://www.tinyint.com/index.php/2009/11/24/certificate-authority-request-monitoring-with-powershell/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 23:26:46 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[certificate services]]></category>
		<category><![CDATA[windows 2008]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=166</guid>
		<description><![CDATA[Rolling out a certificate authority in Windows 2003 and Windows 2008 is a relatively trivial task if you are deploying a stand-alone CA, Enterprise CA’s are a bit more complex, but that&#8217;s a post for another day. The web interface (http://server.domain.local/certsrv/) is pretty limited and doesn’t provide the greatest interface for manually requesting certificates, it [...]]]></description>
			<content:encoded><![CDATA[<p>Rolling out a certificate authority in Windows 2003 and Windows 2008 is a relatively trivial task if you are deploying a stand-alone CA, Enterprise CA’s are a bit more complex, but that&#8217;s a post for another day.  The web interface (http://server.domain.local/certsrv/) is pretty limited and doesn’t provide the greatest interface for manually requesting certificates, it even relies on cookies for managing requests.  It would be really nice to see Microsoft build this into a truly useful application like what you get with the <a href="https://ssl-certificate-center.thawte.com/process/retail/console_login?application_locale=THAWTE_US">Thawte Certificate Center</a>.</p>
<p>One thing that is a bit frustrating is that even when you have the logging options fully enabled for the CA, events aren’t logged for new certificate requests so you have to manually check the server on a regular basis for outstanding requests.  Usually this is a low priority kind of service in your enterprise and can get neglected, which has happened in my case a few times.</p>
<p>This neglect prompted me to write the following Powershell script which very simply uses <a href="http://technet.microsoft.com/en-us/library/cc732443%28WS.10%29.aspx">certutil</a> to check if there are any pending requests, and then fire off an email to a list of users if there are.  This script could also be easily modified to check for revoked certificates or to generate a weekly report on existing certificates to monitor expiration dates, among a bunch of other things, however I really only needed this for requests so that&#8217;s all it does for right now.  If anyone has any interest in something else, let me know and I’ll see about updating the script to include additional features.</p>
<p>To use this script, all you need to do is ensure you have a copy of certutil on the machine running this, update the configurable pieces of the script, then create a scheduled task to run it every hour or so, or whatever time-frame is appropriate for you and your organization.</p>
<p>More information and a download link is after the break&#8230;<br />
<span id="more-166"></span></p>
<p>The script uses a very simple function of certutil to check for pending requests.  You can execute the following code from a command prompt or powershell prompt to see a list of existing pending requests.</p>
<pre class="brush: plain; title: ; notranslate">

certutil -view -out &quot;Request ID, Request Submission Date, Request Common Name, Requester Name, Request Email Address, Request Distinguished Name, CertificateTemplate, Request Disposition&quot; -Restrict &quot;Request Disposition=9&quot; -config &quot;&lt;CA_SERVER_NAME&gt;\&lt;CA_NAME&gt;&quot;
</pre>
<p>Basically what this is doing is it is telling certutil to check for any certificates where the request dispoition is 9, in other words, any pending certificate requests.  It then outputs a few usefull properties related to the certificates.  All you need to change is the part with &#8220;\&#8221; to include the valid server and name.</p>
<p><strong>Note: </strong>You can omit the entire &#8220;-config &#8220;&lt;CA_SERVER_NAME&gt;\&lt;CA_NAME&gt;&#8221;" piece if you are running this locally from the CA server and only want to retrieve the local information.</p>
<p><strong>For the full powershell script, click the download link here:</strong> <strong><a href="http://www.tinyint.com/wp-content/plugins/download-monitor/download.php?id=4"><img alt="Download monitor_ca_requests.ps1" border="0" src="/images/download.png" style="width: 48px; height: 48px; border-width: 0pt; border-style: solid; vertical-align: middle;" title="Download monitor_ca_requests.ps1" /><span style="font-size:14px;">Download monitor_ca_requests.ps1</span></a></strong><br /><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2009/11/24/certificate-authority-request-monitoring-with-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vSphere Client on Windows 7</title>
		<link>http://www.tinyint.com/index.php/2009/09/04/vsphere-client-on-windows-7/</link>
		<comments>http://www.tinyint.com/index.php/2009/09/04/vsphere-client-on-windows-7/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 22:27:47 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[vsphere]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=122</guid>
		<description><![CDATA[Update 2010-03-03: Keep in mind that this was fixed in vSphere 4 Update 1. Although if you can&#8217;t move to Update 1 for some reason, this will still work. Update 2009-09-08: I just updated the script because I received a report from wohali (Joan) over at VMware communities that they had a problem when the [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Update 2010-03-03: Keep in mind that this was fixed in vSphere 4 Update 1.  Although if you can&#8217;t move to Update 1 for some reason, this will still work.</p></blockquote>
<blockquote><p>Update 2009-09-08: I just updated the script because I received a report from wohali (Joan) over at VMware communities that they had a problem when the vSphere client was installed on a different drive and I have now fixed that problem.  I also added in support for making the host update utility work as well.  Lastly, I added a few output messages so you can see what&#8217;s going on and know what is getting done.</p></blockquote>
<p>The past few months I have been enjoying <a href="http://www.microsoft.com/windows/windows-7/">Windows 7</a> quite a bit (both the RC and now the RTM), but at the office we use VMware for many of our clients and the vSphere Client unfortunately has an issue with Windows 7 due to an incompatibility with a .Net 2.0 library dll that comes installed on Windows 7.  When you install the vSphere client, you will be able to get through the install without an issue usually (If you have <a href="http://communities.vmware.com/thread/211494">J# already installed</a> you may encounter issues installing the vSphere client), but once you try to connect to your vSphere server you get an error stating “Error parsing &lt;server&gt; clients.xml file  Login will continue contact your system administrator” followed immediately by another error “The type initializer for &#8220;VirtualInfrastrcture.Utils.HttpWebRequestProxy&#8221; threw an exception” which then brings you back to the login screen and you are unable to connect in.<br />
<span id="more-122"></span><br />
There’s big <a href="http://communities.vmware.com/thread/211440">thread</a> over at VMware Communities that discusses this problem and ways to fix it.  Unfortunately, it’s a manual process and deploying this out to all of our Windows 7 employee workstations is a bit of a hassle, so I have created a Powershell script that will do the necessary work for you, and create a shortcut on your desktop as well.</p>
<p>By default, powershell security options may prevent you from executing the script, so you may have to change a setting temporarily to get it to work.  If you type “<a href="http://technet.microsoft.com/en-us/library/dd347644.aspx">Get-ExecutionPolicy</a>” from a powershell window you will most likely see “Restricted” but there are a few others as well which will all prevent you from executing the script.  You can read more about this over at dotnetvj.com where he goes into a little more detail about these execution policies and what they mean.  All you need to do though is type “<a href="http://technet.microsoft.com/en-us/library/dd347628.aspx">Set-ExecutionPolicy</a> Unrestricted”  Just remember that you should probably set the execution policy back to its previous value after you run the script for security purposes.  Lastly, you will also need to run powershell as an administrator if you have UAC turned on because this script has to add files to the installation folder of your vSphere client.</p>
<div id="attachment_124" class="wp-caption alignnone" style="width: 421px"><a href="http://www.tinyint.com/wp-content/uploads/2009/09/launch-powershell.png"><img class="size-full wp-image-124" title="Launch Powershell as Administrator" src="http://www.tinyint.com/wp-content/uploads/2009/09/launch-powershell.png" alt="Launch Powershell as Administrator" width="411" height="599" /></a><p class="wp-caption-text">Launch Powershell as Administrator</p></div>
<p>Once you have powershell running as an administrator and change the execution policy, it is a simple process to run this script, simply CD to the folder that you have extracted the script, and run it by typing “.Windows7vSphere.ps1” and it will do the work of copying over the System.dll and creating the necessary files to launch vSphere client in development mode so it can use the System.dll.</p>
<div id="attachment_125" class="wp-caption alignnone" style="width: 543px"><a href="http://www.tinyint.com/wp-content/uploads/2009/09/powershell-commands.png"><img class="size-full wp-image-125" title="Execute Windows7vSphere.ps1" src="http://www.tinyint.com/wp-content/uploads/2009/09/powershell-commands.png" alt="Execute Windows7vSphere.ps1" width="533" height="438" /></a><p class="wp-caption-text">Change execution policy and execute Windows7vSphere.ps1</p></div>
<p>You should now have an icon on your desktop called “VMware vSphere Client (Windows 7)” which you then simply run as administrator to launch the vSphere client.  The reason you have to launch it as administrator is because it creates an environment variable that lets the vSphere client know that you are giving it a different System.dll to work with.  This is something also discussed in detail in the thread over at VMware Communities.</p>
<p>For anyone interested in powershell, this script also shows a few cool things such as reading from the <a href="http://technet.microsoft.com/en-us/library/dd315408.aspx">registry</a>, writing to an <a href="http://msdn.microsoft.com/en-us/library/system.xml%28VS.85%29.aspx">xml</a> document, as well as creating a windows <a href="http://msdn.microsoft.com/en-us/library/xsy6k3ys%28VS.85%29.aspx">shortcut</a> using pretty simple commands.</p>
<p>Hopefully this will help a few people streamline the process of getting the vSphere client installed on your Windows 7 machines.  If you notice any problems with the script, feel free to comment and let me know and I&#8217;ll try to fix it as soon as possible.</p>
<p><strong>Download the script and the dll needed here:</strong> <strong><a href="http://www.tinyint.com/wp-content/plugins/download-monitor/download.php?id=1"><img alt="Download Windows7vSphere.zip" border="0" src="/images/download.png" style="width: 48px; height: 48px; border-width: 0pt; border-style: solid; vertical-align: middle;" title="Download Windows7vSphere.zip" /><span style="font-size:14px;">Download Windows7vSphere.zip</span></a></strong><br /><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2009/09/04/vsphere-client-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Enumerate Distribution Groups Script Updated&#8230;</title>
		<link>http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/</link>
		<comments>http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 18:29:02 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[enumerate members]]></category>
		<category><![CDATA[get-distributiongroupmember]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=97</guid>
		<description><![CDATA[A reader sent in a question asking how to enumerate groups that have spaces in them and this lead me to realize I didn&#8217;t follow the specifications for valid distinguished names as well as I thought I had.  If you take a look at RFC 2253 and the Microsoft page that defines security group names, [...]]]></description>
			<content:encoded><![CDATA[<p>A reader sent in a question asking how to <a href="http://www.tinyint.com/index.php/2009/05/24/enumerate-distribution-group-members/" target="_self">enumerate groups</a> that have spaces in them and this lead me to realize I didn&#8217;t follow the specifications for valid distinguished names as well as I thought I had.  If you take a look at <a href="http://www.ietf.org/rfc/rfc2253.txt" target="_blank">RFC 2253</a> and the Microsoft page that <a href="http://technet.microsoft.com/en-us/library/cc776019%28WS.10%29.aspx" target="_blank">defines security group names</a>, you will see what the allowed characters are for these names.  At this point the validation is a lot better, but it still isn&#8217;t perfect.</p>
<p>If you encounter a situation where you need to enumerate members of a group that my validation does not allow, you can scroll down to line 271 in the script and change the $rx variable to &#8220;.+&#8221; to make it simple which will allow you to pass any characters.  If you pass invalid characters you will get some funny errors happening, but it should work.  You may have to use quotes around the name if you are looking to use spaces or other allowed special characters.</p>
<p>Taking another look at the code, I also found a small bug that was causing the display of notes associated with a group to print out an error about null strings.  This should be fixed now.  If anyone notices any other problems, feel free to comment and let me know and I will try to fix it or add in the change as soon as possible.  I&#8217;ll be posting another update soon that goes the other direction of this script, one that enumerates group membership for a specific user.</p>
<p>Thanks again to Darren from Brisbane(?), Australia for pointing this out.</p>
<p>Here is the updated script download link: <strong><a href="http://www.tinyint.com/wp-content/plugins/download-monitor/download.php?id=3"><img alt="Download enumerate_groups.ps1" border="0" src="/images/download.png" style="width: 48px; height: 48px; border-width: 0pt; border-style: solid; vertical-align: middle;" title="Download enumerate_groups.ps1" /><span style="font-size:14px;">Download enumerate_groups.ps1</span></a></strong><br /><br /><a href="/wp-content/uploads/2009/05/enumerate_groups.ps1"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Enumerate Distribution Group Members</title>
		<link>http://www.tinyint.com/index.php/2009/05/24/enumerate-distribution-group-members/</link>
		<comments>http://www.tinyint.com/index.php/2009/05/24/enumerate-distribution-group-members/#comments</comments>
		<pubDate>Sun, 24 May 2009 21:27:30 +0000</pubDate>
		<dc:creator>tcnolan</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[distribution group]]></category>
		<category><![CDATA[enumerate members]]></category>
		<category><![CDATA[get-distributiongroupmember]]></category>

		<guid isPermaLink="false">http://www.tinyint.com/?p=39</guid>
		<description><![CDATA[Note: Script updated on 2009/07/17 to fix two bugs.  Read more here: http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/ In my organization, we make use of many different groups to separate departments and sub-groups of each department, and many groups build off of this. We also make use of Dynamic Distribution Groups to make things a bit easier on the admin [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-size: small;"><span style="font-family: Calibri;">Note: Script updated on 2009/07/17 to fix two bugs.  Read more here: <a href="http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/">http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/</a></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><br />
In my organization, we make use of many different groups to separate departments and sub-groups of each department, and many groups build off of this.<span style="mso-spacerun: yes;"> </span>We also make use of Dynamic Distribution Groups to make things a bit easier on the admin side of things.<span style="mso-spacerun: yes;"> </span>When tasked with cleaning up these distribution groups and making them easier to manage, it was a bit difficult determining who was supposed to receive mail for what group.<span style="mso-spacerun: yes;"> </span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-family: Calibri; font-size: small;">This is because the Get-DistributionGroupMember cmdlet doesn’t have a parameter like –expand which will give you all of the child groups and their members as well.<span style="mso-spacerun: yes;"> </span>If you have a group called “Engineering” which then has 4 child groups for each department and then each of those groups has each individual mailbox, when you perform “Get-DistributionGroupMember -Identity Engineering”, you will only see the four child groups, not each member of those as well.<span style="mso-spacerun: yes;"> </span>This became a big issue because of how much we rely on sub-groups in our organization, and after a lot of investigation it turned out there was no way to do this built in directly to any cmdlet, so I wrote a script that would do this for me.  If you need to recursively enumerate distribution group members you are unfortunately out of luck with built in cmdlets.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-family: Calibri; font-size: small;">There are a number of scripts out there that serve a similar purpose as the one I have created, but most do not handle mail contacts or dynamic distribution groups, so I figured if I am going to have to add functionality, I might as well write it myself from the ground up.<span style="mso-spacerun: yes;"> </span>So now, if you are ever in need of getting child members of a distribution group you can use this script to help you out.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-family: Calibri; font-size: small;">One nice feature here is if you specify “-showTree” as a parameter, it will display a treeview of all the groups.<span style="mso-spacerun: yes;"> </span>Without -showtree it will just grab all child members and display them in a flat view.<span style="mso-spacerun: yes;"> </span>The script is pretty long because I included help text that displays if you run the script without any parameters, and for that reason I am just posting it as a download link.<span style="mso-spacerun: yes;"> </span>Hope this helps a few people out there who went through the same trouble I did finding out that there is no built in way to do this!</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-family: Calibri; font-size: small;"><br />
</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-size: small;"><span style="font-family: Calibri;">Download Link: </span></span><strong><a href="http://www.tinyint.com/wp-content/plugins/download-monitor/download.php?id=3"><img alt="Download enumerate_groups.ps1" border="0" src="/images/download.png" style="width: 48px; height: 48px; border-width: 0pt; border-style: solid; vertical-align: middle;" title="Download enumerate_groups.ps1" /><span style="font-size:14px;">Download enumerate_groups.ps1</span></a></strong><br /><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinyint.com/index.php/2009/05/24/enumerate-distribution-group-members/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

