<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1823176357928063709</id><updated>2026-09-27T03:34:51.491-07:00</updated><category term="Powershell"/><category term="3.0"/><category term="AWS"/><category term="Amazon"/><category term="S3"/><category term="SushiHangover-Tools"/><category term="EC2"/><category term="RSA"/><category term="Text Encoding"/><category term="Tools"/><category term="Windows 8"/><category term="iPhone"/><category term="Add-Type"/><category term="Bacon"/><category term="Book"/><category term="C#"/><category term="CDROM"/><category term="COM"/><category term="Cache"/><category term="Credentials"/><category term="DNS"/><category term="Defrag"/><category term="Directory"/><category term="Encryption"/><category term="F Sharp"/><category term="Flash Drive"/><category term="Fusion"/><category term="GZ"/><category term="GZip"/><category term="Happy New Year"/><category term="Hyper-V"/><category term="IE"/><category term="IIS"/><category term="Media"/><category term="Memory"/><category term="Mime Type"/><category term="Netbook"/><category term="Outlook"/><category term="RSACrypto"/><category term="Rambling"/><category term="Selenium"/><category term="Transcript"/><category term="VMWare"/><category term="WWF"/><category term="Windows Update"/><category term="Windows Workflow Foundation"/><category term="YouTube"/><category term="conversion"/><category term="du"/><category term="founder"/><category term="h264"/><category term="javascript"/><category term="startup"/><category term="transcode"/><category term="xkcd"/><category term="xkcd.com"/><title type='text'>SushiHangover</title><subtitle type='html'>Ramblings about PowerShell, Robo-One, Robotics, and Sushi</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>61</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-4049762820406582393</id><published>2013-03-03T23:28:00.002-08:00</published><updated>2014-02-09T15:58:31.149-08:00</updated><title type='text'>Moving Blog : http://sushihangover.github.io</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
I am moving SushiHangover once again and using Octopus and thus going to a static publishing method as I really do not need features of a dynamic blog engine behind these pages…&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
So bare with me as I get everything moved over and get the kinks worked out.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
As always, comment or email if you need anything…&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;a href=&quot;http://sushihangover.github.io/&quot;&gt;http://sushihangover.github.io&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/4049762820406582393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/03/moving-blog-httpsushihangoverazurewebsi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/4049762820406582393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/4049762820406582393'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/03/moving-blog-httpsushihangoverazurewebsi.html' title='Moving Blog : http://sushihangover.github.io'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-5148262563820498993</id><published>2013-03-03T06:05:00.000-08:00</published><updated>2013-03-03T06:05:00.535-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="DNS"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell : Hostname resolution and pipeline&#39;d output</title><content type='html'>&lt;br /&gt;
There are a ton of cmd line utilities that can do DNS name resolution. This simple function&amp;nbsp;was needed for a couple of projects that I am coding and one of the core parts is I get all the IP addresses for a host name and making it easy to digest on the pipeline was also core and while this is really simple, I could not find an existing DNS cmdlet that had a &#39;PassThru&#39; so I could process the an array of IPHostEntry object.&lt;br /&gt;
&lt;br /&gt;
So &quot;Resolve-Host&quot; was just coded up and it handles IP-&amp;gt;Name, Name-&amp;gt;IP,&amp;nbsp;IPHostEntry output via the -PassThru parameter, etc.. Take a look at the examples and you can see how easy it is to use.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
As always, get the latest at my &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;GitHub Account&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;Example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;Resolve-HostName -ComputerName google.com&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.36&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;Example&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;Resolve-HostName google.com -Count -1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.36&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.37&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.38&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.39&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.40&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.41&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.46&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.32&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.33&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.34&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.35&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;Example&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;&#39;google.com&#39; | Resolve-Host -PassThru | Select-Object -ExpandProperty AddressList |ft&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Address AddressFamily ScopeId &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6Multic IsIPv6LinkLo IsIPv6SiteLo IsIPv6Teredo IsIPv4Mapped IPAddressToS&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ast&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cal&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cal&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ToIPv6 tring&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------- ------------- ------- &amp;nbsp; &amp;nbsp; &amp;nbsp; ------------ ------------ ------------ ------------ ------------ ------------&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 119653037&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.7&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 136430253&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.8&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 153207469&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.9&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 237093549&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.3...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2212525&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18989741&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35766957&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 52544173&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.3&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 69321389&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.4&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 86098605&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 102875821&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.6&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;Example&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;Resolve-HostName www.windowsphone.com -PassThru |Select-Object -ExpandProperty AddressList&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Address&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 3870373789&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AddressFamily&amp;nbsp; &amp;nbsp; &amp;nbsp; : InterNetwork&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ScopeId&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6Multicast&amp;nbsp; &amp;nbsp; : False&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6LinkLocal&amp;nbsp; &amp;nbsp; : False&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6SiteLocal&amp;nbsp; &amp;nbsp; : False&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6Teredo &amp;nbsp; &amp;nbsp; &amp;nbsp; : False&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv4MappedToIPv6 : False&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IPAddressToString&amp;nbsp; : 157.55.177.230&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;Example&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;@(&#39;google.com&#39;,&#39;www.bing.com&#39;) | Resolve-Host -PassThru&amp;nbsp; | fl&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HostName&amp;nbsp; &amp;nbsp; : google.com&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aliases &amp;nbsp; &amp;nbsp; : {}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AddressList : {173.194.33.4, 173.194.33.5, 173.194.33.6, 173.194.33.7...}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; min-height: 12px;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HostName&amp;nbsp; &amp;nbsp; : a134.dsw3.akamai.net&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aliases &amp;nbsp; &amp;nbsp; : {}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AddressList : {96.17.15.115, 96.17.15.139, 23.3.105.35, 23.3.105.17}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;Set-StrictMode&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;–Version&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;latest&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Resolve-Host&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Resolve a host to a set of IP address(es)&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This DNS function has the ability to return the first IP address for a host, a number of the addresses (or all), and also supports the&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;PassThru&quot; parameter to get back an array of IPAddress Class&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;Resolve-HostName -ComputerName google.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.36&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;Resolve-HostName google.com -Count -1&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.36&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.37&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.38&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.39&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.40&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.41&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.46&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.32&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.33&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.34&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 173.194.33.35&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;&#39;google.com&#39; | Resolve-Host -PassThru | Select-Object -ExpandProperty AddressList |ft&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Address AddressFamily ScopeId &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6Multic IsIPv6LinkLo IsIPv6SiteLo IsIPv6Teredo IsIPv4Mapped IPAddressToS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ast&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cal&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cal&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ToIPv6 tring&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------- ------------- ------- &amp;nbsp; &amp;nbsp; &amp;nbsp; ------------ ------------ ------------ ------------ ------------ ------------&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 119653037&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.7&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 136430253&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.8&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 153207469&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.9&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 237093549&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.3...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2212525&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18989741&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.1&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35766957&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.2&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 52544173&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.3&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 69321389&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.4&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 86098605&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.5&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 102875821&amp;nbsp; InterNetwork&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; False 173.194.33.6&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;Resolve-HostName www.windowsphone.com -PassThru |Select-Object -ExpandProperty AddressList&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Address&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 3870373789&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AddressFamily&amp;nbsp; &amp;nbsp; &amp;nbsp; : InterNetwork&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ScopeId&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6Multicast&amp;nbsp; &amp;nbsp; : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6LinkLocal&amp;nbsp; &amp;nbsp; : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6SiteLocal&amp;nbsp; &amp;nbsp; : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv6Teredo &amp;nbsp; &amp;nbsp; &amp;nbsp; : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsIPv4MappedToIPv6 : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IPAddressToString&amp;nbsp; : 157.55.177.230&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:PS&amp;gt;@(&#39;google.com&#39;,&#39;www.bing.com&#39;) | Resolve-Host -PassThru&amp;nbsp; | fl&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HostName&amp;nbsp; &amp;nbsp; : google.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aliases &amp;nbsp; &amp;nbsp; : {}&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AddressList : {173.194.33.4, 173.194.33.5, 173.194.33.6, 173.194.33.7...}&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HostName&amp;nbsp; &amp;nbsp; : a134.dsw3.akamai.net&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aliases &amp;nbsp; &amp;nbsp; : {}&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AddressList : {96.17.15.115, 96.17.15.139, 23.3.105.35, 23.3.105.17}&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(DefaultParameterSetName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Limit&#39;&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Param&lt;/span&gt;(&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Parameter&lt;/span&gt;(Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeLine&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;Position&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ComputerName&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Parameter&lt;/span&gt;(ParameterSetName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Limit&#39;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Alias&lt;/span&gt;(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Count&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Parameter&lt;/span&gt;(Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;Position&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeLine&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$First&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Parameter&lt;/span&gt;(ParameterSetName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;PassThru&#39;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Parameter&lt;/span&gt;(Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;Position&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeLine&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$PassThru&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Name lookup on &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ComputerName&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Addresses&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;System.Net.DNS&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;GetHostEntry(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ComputerName&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$PassThru&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Addresses&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$First&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Addresses&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;AddressList&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;].&lt;/span&gt;IPAddressToString&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;elseif&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$First&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-lt&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Addresses&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;AddressList&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IPAddressToString&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt; @()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Address&lt;/span&gt; &lt;span style=&quot;color: #011b9d;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Addresses&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;AddressList) {&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;# can not use break as this is pipeline&#39;d, so use the old fashion if/else&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-lt&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Addresses&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;AddressList&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Count) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-lt&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$First&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=+&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Address&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IPAddressToString&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;++&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Output&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/5148262563820498993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/03/powershell-hostname-resolution-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/5148262563820498993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/5148262563820498993'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/03/powershell-hostname-resolution-and.html' title='PowerShell : Hostname resolution and pipeline&#39;d output'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-2163631141921935311</id><published>2013-03-02T00:24:00.002-08:00</published><updated>2013-03-02T00:24:41.166-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="GZ"/><category scheme="http://www.blogger.com/atom/ns#" term="GZip"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell : GZip (.gz) Compress and Decompress routines</title><content type='html'>&lt;br /&gt;
This is another quick set of functions that I throw together in order to handle some GZip files that I was dealing with (including the MaxMind GeoIP databases, FYI : That library is coming very soon to the SushiHangover Tools module).&lt;br /&gt;
&lt;br /&gt;
In using the existing verb set from PowerShell 3.0, the new GZip routines are:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Expand-GZip&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Compress-GZip&lt;/li&gt;
&lt;/ul&gt;
You need to decompress a bunch of .GZ files, then all you need to do is pipeline in the files (i.e. ls *gz) and the decompress versions will be saved in the same directory with the &quot;.gz&quot;extension removed:&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;ls .\RegionName.cs.gz | Expand-GZip -Verbose -WhatIf&lt;/li&gt;
&lt;/ul&gt;
Need to change the extension and/or rename the file at the same time you are decompressing? Just use the &#39;-NewName&#39; parameter:&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; margin-left: 36px; text-indent: -36px;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Expand-GZip -FullName CompressFile.xml.gz -NewName NotCompressed.xml&lt;/li&gt;
&lt;/ul&gt;
Uncompressing GZip files is just as easy, pipeline a bunch of files to Compress-GZip and they will be compressed and &quot;.gz&quot; extension will automatically by added.&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px; margin-left: 36px; text-indent: -36px;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;ls .\NotCompressFile.xml | Compress-GZip -Verbose -WhatIf&lt;/li&gt;
&lt;/ul&gt;
Need to create GZip files with non-standard extensions, really?, fine use the &quot;-NewName&quot; parameter and have your wish.&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Compress-GZip -FullName NotCompressFile.xml -NewName Compressed.xml.funkyextension&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;h2&gt;
As always, get the latest as my &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;GitHub account.&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;lt;#&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
.NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; Copyright 2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
.SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; GZip Compress and DeCompress&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
.DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; A 8k buffered GZip (.gz) Compress and DeCompress functions that support pipelined input&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
.LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
.LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
#&amp;gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Compress-GZip&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GZip Compress (.gz)&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A buffered GZip (.gz) Compress function that support pipelined input&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .Example&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ls .\NotCompressFile.xml | Compress-GZip -Verbose -WhatIf&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .Example&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Compress-GZip -FullName NotCompressFile.xml -NewName Compressed.xml.funkyextension&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Alias&lt;/span&gt;(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;PSPath&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Alias&lt;/span&gt;(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;NewName&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$_BufferSize&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;1024&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;8&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;Test-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-PathType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Leaf&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Reading from: &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Length &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$tmpPath&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Join-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$tmpPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;DirectoryName) &lt;span style=&quot;color: #011993;&quot;&gt;-ChildPath&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$tmpPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Name &lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;.gz&#39;&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;Test-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-PathType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Leaf&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-IsValid&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Compressing to: &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Error&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Message&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt; is not a valid path/file&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Error&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Message&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; does not exist&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;Test-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-PathType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Leaf&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;If&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Overwrite Existing File @ &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Touch-File&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Create new Compressed File @ &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Touch-File&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Creating Compress File @ &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Opening streams and file to save compressed version to...&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$input&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;System.IO.FileStream&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;FullName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileMode&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Open)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileAccess&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Read)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileShare&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Read);&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$output&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;System.IO.FileStream&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;FullName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileMode&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Create)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileAccess&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Write)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileShare&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;None)&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$gzipStream&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;System.IO.Compression.GzipStream&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$output&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.Compression.CompressionMode&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Compress)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$buffer&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;byte[]&lt;/span&gt;(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$_BufferSize&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$read&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$input&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Read(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$buffer&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$_BufferSize&lt;/span&gt;))&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$read&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-le&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$gzipStream&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Write(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$buffer&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$read&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;finally&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Closing streams and newly compressed file&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$gzipStream&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Close();&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$output&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Close();&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$input&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Close();&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Expand-GZip&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GZip Decompress (.gz)&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A buffered GZip (.gz) Decompress function that support pipelined input&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .Example&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ls .\RegionName.cs.gz | Expand-GZip -Verbose -WhatIf&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .Example&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Expand-GZip -FullName CompressFile.xml.gz -NewName NotCompressed.xml&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Alias&lt;/span&gt;(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;PSPath&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Alias&lt;/span&gt;(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;NewName&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$null&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;Test-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-PathType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Leaf&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Reading from: &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Length &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$tmpPath&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Join-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$tmpPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;DirectoryName) &lt;span style=&quot;color: #011993;&quot;&gt;-ChildPath&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$tmpPath&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;BaseName)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;Test-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-PathType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Leaf&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-IsValid&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Decompressing to: &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Error&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Message&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; is not a valid path/file&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Error&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Message&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt; does not exist&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;return&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;Test-Path&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-PathType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Leaf&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;If&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Overwrite Existing File @ &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Touch-File&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ShouldProcess(&lt;/span&gt;&quot;Create new decompressed File @ &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&quot;&lt;span style=&quot;color: black;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Touch-File&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ShouldProcess(&lt;/span&gt;&quot;Creating Decompressed File @ &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;&quot;&lt;span style=&quot;color: black;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Opening streams and file to save compressed version to...&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$input&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;System.IO.FileStream&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$FullName&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;FullName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileMode&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Open)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileAccess&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Read)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileShare&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Read);&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$output&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;System.IO.FileStream&lt;/span&gt; (&lt;span style=&quot;color: #0433ff;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-path&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$GZipPath&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;FullName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileMode&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Create)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileAccess&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;Write)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.FileShare&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;None)&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$gzipStream&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;System.IO.Compression.GzipStream&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$input&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;IO.Compression.CompressionMode&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Decompress)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$buffer&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;byte[]&lt;/span&gt;(&lt;span style=&quot;color: #942193;&quot;&gt;1024&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$read&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$gzipStream&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Read(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$buffer&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;1024&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$read&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-le&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$output&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Write(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$buffer&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$read&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;finally&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Closing streams and newly decompressed file&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$gzipStream&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Close();&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$output&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Close();&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$input&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Close();&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/2163631141921935311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/03/powershell-gzip-gz-compress-and.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2163631141921935311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2163631141921935311'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/03/powershell-gzip-gz-compress-and.html' title='PowerShell : GZip (.gz) Compress and Decompress routines'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-7423795664292601795</id><published>2013-02-14T22:23:00.001-08:00</published><updated>2013-02-14T22:23:34.213-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="COM"/><category scheme="http://www.blogger.com/atom/ns#" term="Outlook"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell and Outlook : Marking everything as read...</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
Just a quickie...&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
Have a ton of subfolder&#39;s in Outlook and does it drive you crazy that there is no way to mark everything as read with just one click in Outlook, well, PowerShell and Outlook COM automation to the rescue.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
All you need to do is replace the &lt;youremailaccountnamehere&gt; with your top level account mail in the code below (it is the top node of your Inbox on the right side side tree view in Outlook).&lt;/youremailaccountnamehere&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
Once you have the &#39;Inbox&#39; assigned to $MyFolders, just execute the next line and all your email will be set as &#39;Read&#39;. It is your problem if you are setting all you boss&#39; email to Read, but you can expand upon the code to prevent that....&lt;/div&gt;
&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$MyFolders = $outlook.Application.GetNamespace(&quot;MAPI&quot;).Folders.item(&quot;&lt;youremailaccountnamehere&gt;&quot;).folders.item(&quot;Inbox&quot;).Folders&lt;br /&gt;ForEach ($MyFolder in $MyFolders) { ForEach ($Item in $MyFolder.Items.Restrict(&quot;[unread] = true&quot;)) { $Item.UnRead = $false  } }&lt;/youremailaccountnamehere&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;b&gt;Some misc. blog posting regarding Outlook and PowerShell:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/26/use-powershell-to-data-mine-your-outlook-inbox.aspx&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
http://blogs.msdn.com/b/jmanning/archive/2007/01/25/using-powershell-for-outlook-automation.aspx&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
http://poshcode.org/2695&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/7423795664292601795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/02/powershell-and-outlook-marking.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/7423795664292601795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/7423795664292601795'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/02/powershell-and-outlook-marking.html' title='PowerShell and Outlook : Marking everything as read...'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-5716757993955137527</id><published>2013-02-10T22:41:00.002-08:00</published><updated>2013-02-10T22:41:45.933-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Add-Type"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Cache"/><category scheme="http://www.blogger.com/atom/ns#" term="IE"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="SushiHangover-Tools"/><category scheme="http://www.blogger.com/atom/ns#" term="Tools"/><title type='text'>Clearing your Internet Explorer (IE) cache with PowerShell</title><content type='html'>If you are doing any kind of web development, manual or automated browser testing, clearing the IE cache is something that has to be done on a regular basis in order to ensure that IE is using all of the latest versions of your plugin components, JavaScript, CSS, etc... files. There is nothing more frustrating to be fighting a code issue only to find out that IE is using an older version of the object or file hidden in its cache.&amp;nbsp;&lt;i&gt;Well, no more of that.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I had written this IE cache C# class for an IT operations toolset awhile back from code that I found on the &#39;Net (MSDN?) and would actually fire up the whole tool just to click the &#39;Clear IE Cache&#39; button. I stripped the C# file down to just the essentials and wrapped it in a Add-Type &amp;nbsp;routine so you can just type &#39;Clear-IECache&#39; anytime or add it to your automated testing tests (like your .Net Webdriver script if you are using Selenium).&lt;br /&gt;
&lt;br /&gt;
Note: Clearing the cache, depending upon how many items are in it, can take some time. There currently are no call back&amp;nbsp;events, thus I am not displaying a PowerShell Progress bar, but if someone asks, I can add that to the C# code and code a function using Write-Progress.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
FYI: If anyone knows of a better way to handle this within Windows/IE I would love to here about it!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As always, get the latest as my &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;GitHub account&lt;/a&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
Set-StrictMode&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;–Version&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;latest&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Clear-IECache&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2012/2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Clear Internet Explorer&#39;s cache&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This function wraps a custom C# based function that clears the IE cache, this has been tested on Internet Explorer 8, 9, &amp;amp; 10.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Clearing the cache, depending upon how many items are in it, can take some time. There currently are no call back&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; events, thus I am not displaying a PowerShell Progress bar, but if someone asks, I can add that to the C# code.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c:\PS&amp;gt;Clear-IECache&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;$CSFile&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Join-Path&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$PSScriptRoot&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-ChildPath&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;ClearIECache.cs’&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$SourceCode&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;System.IO.File&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]::&lt;/span&gt;ReadAllText(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$CSFile&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Assemblies&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;System&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;#,&#39;System.Collections.Generic&#39;,&#39;System.Ling&#39;,&#39;System.Text&#39;,&#39;System.Runtime.InteropServices&#39;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Add-Type&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-TypeDefinition&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$SourceCode&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-ReferencedAssemblies&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Assemblies&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-IgnoreWarnings&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-Language&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;CSharp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;catch&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Warning&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;An error occurred attempting to add the .NET Framework class to the PowerShell session.&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Warning&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;The error was: &lt;/span&gt;$(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Error&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;].&lt;/span&gt;Exception&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Message)&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ieCache&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;SushiHangover.ClearIECache&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$ieCache&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Clear()&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;$ieCache&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$null&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
using System;&lt;br /&gt;

using System.Collections.Generic;&lt;br /&gt;

using System.Linq;using System.Text;&lt;br /&gt;

using System.Runtime.InteropServices;&lt;br /&gt;

namespace SushiHangover&lt;br /&gt;

{&lt;br /&gt;

&amp;nbsp; &amp;nbsp; // Class for deleting the cache.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; public class ClearIECache&lt;br /&gt;

&amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Contains information about an entry in the Internet cache&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [StructLayout(LayoutKind.Explicit, Size = 80)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public struct INTERNET_CACHE_ENTRY_INFOA&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(0)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwStructSize;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(4)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public IntPtr lpszSourceUrlName;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(8)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public IntPtr lpszLocalFileName;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(12)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint CacheEntryType;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(16)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwUseCount;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(20)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwHitRate;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(24)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwSizeLow;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(28)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwSizeHigh;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(32)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public FILETIME LastModifiedTime;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(40)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public FILETIME ExpireTime;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(48)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public FILETIME LastAccessTime;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(56)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public FILETIME LastSyncTime;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(64)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public IntPtr lpHeaderInfo;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(68)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwHeaderInfoSize;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(72)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public IntPtr lpszFileExtension;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(76)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwReserved;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [FieldOffset(76)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint dwExemptDelta;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Initiates the enumeration of the cache groups in the Internet cache&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DllImport(@&quot;wininet&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetLastError = true,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CharSet = CharSet.Auto,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntryPoint = &quot;FindFirstUrlCacheGroup&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CallingConvention = CallingConvention.StdCall)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern IntPtr FindFirstUrlCacheGroup(&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int dwFlags,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int dwFilter,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpSearchCondition,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int dwSearchCondition,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ref long lpGroupId,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpReserved);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Retrieves the next cache group in a cache group enumeration&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DllImport(@&quot;wininet&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetLastError = true,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CharSet = CharSet.Auto,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntryPoint = &quot;FindNextUrlCacheGroup&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CallingConvention = CallingConvention.StdCall)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern bool FindNextUrlCacheGroup(&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr hFind,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ref long lpGroupId,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpReserved);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Releases the specified GROUPID and any associated state in the cache index file&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DllImport(@&quot;wininet&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetLastError = true,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CharSet = CharSet.Auto,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntryPoint = &quot;DeleteUrlCacheGroup&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CallingConvention = CallingConvention.StdCall)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern bool DeleteUrlCacheGroup(&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; long GroupId,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int dwFlags,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpReserved);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Begins the enumeration of the Internet cache&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DllImport(@&quot;wininet&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetLastError = true,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CharSet = CharSet.Auto,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntryPoint = &quot;FindFirstUrlCacheEntryA&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CallingConvention = CallingConvention.StdCall)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern IntPtr FindFirstUrlCacheEntry(&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpFirstCacheEntryInfo,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ref int lpdwFirstCacheEntryInfoBufferSize);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Retrieves the next entry in the Internet cache&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DllImport(@&quot;wininet&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetLastError = true,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CharSet = CharSet.Auto,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntryPoint = &quot;FindNextUrlCacheEntryA&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CallingConvention = CallingConvention.StdCall)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern bool FindNextUrlCacheEntry(&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr hFind,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpNextCacheEntryInfo,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ref int lpdwNextCacheEntryInfoBufferSize);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For PInvoke: Removes the file that is associated with the source name from the cache, if the file exists&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [DllImport(@&quot;wininet&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetLastError = true,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CharSet = CharSet.Auto,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EntryPoint = &quot;DeleteUrlCacheEntryA&quot;,&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CallingConvention = CallingConvention.StdCall)]&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern bool DeleteUrlCacheEntry(&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr lpszUrlName);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void Clear()&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Indicates that all of the cache groups in the user&#39;s system should be enumerated&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const int CACHEGROUP_SEARCH_ALL = 0x0;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Indicates that all the cache entries that are associated with the cache group&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // should be deleted, unless the entry belongs to another cache group.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const int CACHEGROUP_FLAG_FLUSHURL_ONDELETE = 0x2;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // File not found.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const int ERROR_FILE_NOT_FOUND = 0x2;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // No more items have been found.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const int ERROR_NO_MORE_ITEMS = 259;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Pointer to a GROUPID variable&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; long groupId = 0;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Local variables&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int cacheEntryInfoBufferSizeInitial = 0;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int cacheEntryInfoBufferSize = 0;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr cacheEntryInfoBuffer = IntPtr.Zero;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INTERNET_CACHE_ENTRY_INFOA internetCacheEntry;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr enumHandle = IntPtr.Zero;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bool returnValue = false;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Delete the groups first.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Groups may not always exist on the system.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For more information, visit the following Microsoft Web site:&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // http://msdn.microsoft.com/library/?url=/workshop/networking/wininet/overview/cache.asp&amp;nbsp; &lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // By default, a URL does not belong to any group. Therefore, that cache may become&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // empty even when the CacheGroup APIs are not used because the existing URL does not belong to any group.&amp;nbsp; &lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; enumHandle = FindFirstUrlCacheGroup(0, CACHEGROUP_SEARCH_ALL, IntPtr.Zero, 0, ref groupId, IntPtr.Zero);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // If there are no items in the Cache, you are finished.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (enumHandle != IntPtr.Zero &amp;amp;&amp;amp; ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error())&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Loop through Cache Group, and then delete entries.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (true)&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Delete a particular Cache Group.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnValue = DeleteUrlCacheGroup(groupId, CACHEGROUP_FLAG_FLUSHURL_ONDELETE, IntPtr.Zero);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!returnValue &amp;amp;&amp;amp; ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error())&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnValue = FindNextUrlCacheGroup(enumHandle, ref groupId, IntPtr.Zero);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!returnValue &amp;amp;&amp;amp; (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() || ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error()))&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Start to delete URLs that do not belong to any group.&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; enumHandle = FindFirstUrlCacheEntry(null, IntPtr.Zero, ref cacheEntryInfoBufferSizeInitial);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (enumHandle == IntPtr.Zero &amp;amp;&amp;amp; ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error())&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cacheEntryInfoBuffer = Marshal.AllocHGlobal(cacheEntryInfoBufferSize);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; enumHandle = FindFirstUrlCacheEntry(null, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (true)&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; internetCacheEntry = (INTERNET_CACHE_ENTRY_INFOA)Marshal.PtrToStructure(cacheEntryInfoBuffer, typeof(INTERNET_CACHE_ENTRY_INFOA));&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cacheEntryInfoBufferSizeInitial = cacheEntryInfoBufferSize;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnValue = DeleteUrlCacheEntry(internetCacheEntry.lpszSourceUrlName);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!returnValue)&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!returnValue &amp;amp;&amp;amp; ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error())&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!returnValue &amp;amp;&amp;amp; cacheEntryInfoBufferSizeInitial &amp;gt; cacheEntryInfoBufferSize)&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial;&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cacheEntryInfoBuffer = Marshal.ReAllocHGlobal(cacheEntryInfoBuffer, (IntPtr)cacheEntryInfoBufferSize);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Marshal.FreeHGlobal(cacheEntryInfoBuffer);&lt;br /&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;

&amp;nbsp; &amp;nbsp; }&lt;br /&gt;

}&lt;br /&gt;

&lt;div style=&quot;min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/5716757993955137527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/02/clearing-your-internet-explorer-ie.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/5716757993955137527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/5716757993955137527'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/02/clearing-your-internet-explorer-ie.html' title='Clearing your Internet Explorer (IE) cache with PowerShell'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-6959601952082423209</id><published>2013-02-03T11:40:00.002-08:00</published><updated>2013-02-03T12:03:44.210-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="SushiHangover-Tools"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8"/><title type='text'>Put your computer to sleep with the Sleep-Computer cmdliet</title><content type='html'>&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;i&gt;Hey, I can not find the Sleep-Computer cmdlet, I see the Stop-Computer and Restart-Computer cmdlets but where did you find a Sleep-Computer cmdlet?&lt;/i&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Well, there was not one. Most of the PowerShell cmdlets are dealing with automation of servers and odd ball functions like sleeping a laptop normally would not be a top priority of the Windows Management Foundation / PowerShell group. Enough said...&lt;br /&gt;
&lt;br /&gt;
So I put a quickie function together and added to my SushiHangover-Tools because I tend to live in a shell, even on a laptop. Try a week without the &#39;Desktop Experience&#39; in Windows and only use PowerShell to get all your work done, and I will send your a prize if you make it.... FYI: you can cheat &amp;nbsp;and use a browser for your email if you have to ;-)&lt;br /&gt;
&lt;br /&gt;
Have fun and as always get the latest on my &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;GitHub account&lt;/a&gt;.&lt;br /&gt;
&lt;span style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;Set-StrictMode&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;–Version&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;latest&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Sleep-Computer&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Place your computer into Sleep mode&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Since there is not a cmdlet that will &#39;sleep&#39; your computer, the Sleep-Computer function was born. You can use&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; the force option to override/clear your hibernate setting and then sleep if you need to...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c:\PS&amp;gt;Sleep-Computer -WhatIf&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; What if: Performing operation &quot;Sleep-Computer&quot; on Target &quot;SushiHangover-MacBookPro&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c:\PS&amp;gt;Sleep-Computer -Confirm -Force&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Sleep-Computer&quot; on Target &quot;V-RONEES-W8MBP&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;):&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;$pscmdlet&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ShouldProcess(&lt;/span&gt;$env:COMPUTERNAME&lt;span style=&quot;color: black;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Turning off hibernation&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;powercfg&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-hibernate&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;off&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$rundll&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Join-Path&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Path&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$env:windir&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-ChildPath&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;System32\rundll32.exe&quot;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$rundll&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;powrprof.dll&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;SetSuspendState&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
For more information on Sleeping from the cmd line :&amp;nbsp;http://superuser.com/questions/463646/is-there-a-command-line-tool-to-put-windows-8-to-sleep&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/6959601952082423209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/02/put-your-computer-to-sleep-with-sleep.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/6959601952082423209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/6959601952082423209'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/02/put-your-computer-to-sleep-with-sleep.html' title='Put your computer to sleep with the Sleep-Computer cmdliet'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-7795320438204000940</id><published>2013-01-24T19:56:00.000-08:00</published><updated>2013-01-26T10:18:38.352-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Defrag"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell : Optimize-Volume vs. Process-VolumeDefrag</title><content type='html'>I have been using my own defragmentation script for awhile, Process-VolumeDefrag, and thought about deleting it and moving to the &#39;new&#39; cool standard &quot;Optimize-Volume&quot; cmdlet, but that is not going to happen yet...&lt;br /&gt;
&lt;br /&gt;
The Optimize-Volume cmdlet is &#39;cool&#39; since they include the standard PowerShell progress bar (via Write-Progress) and you can see the status (% done) of the command. Really cool, but I have a problem, a big problem for me, they do not pipeline the results within the &quot;DefragAnalysis&quot; object, nor the parent object (&quot;DefragResults&quot;), nor do they expose the errors...&lt;br /&gt;
&lt;br /&gt;
The pretty progress bar is great, but I run defragmentation on a schedule and do not care about that, and the only analysis you can get is via the text of the &quot;-Verbose&quot; parameter, again pretty, but not helpful when you are pipelining the results of &quot;DefragAnalysis&quot; for dashboard reporting or feeding to a system monitoring/status system (SCOM, Nagios, Excel/Visio charts. etc...). Enough gripping, so I updated my script for PowerShell 3.0, Win8/2012, etc...&lt;br /&gt;
&lt;br /&gt;
You can pipeline &quot;Win32_Volume&quot; classes via&amp;nbsp;System.Management.ManagementBaseObject objects to be defrag&#39;d, ie:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
Get-WmiObject -ComputerName $ComputerName&amp;nbsp; -Class Win32_Volume -Filter (&quot;DriveLetter = &#39;&quot; + $DriveLetter + &quot;&#39;&quot;) | Process-VolumeDefrag -Force&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Since these volumes are WMI Objects, they can be from remote machines as well is a local drive, just pipe those volume objects to &quot;Process-VolumeDefrag&quot; and they will be defrag&#39;d.&lt;br /&gt;
&lt;br /&gt;
I also added support to throw exceptions for all the non-zero result codes so you can log the problems to your management system and handle them via your in-house alert system:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #942193;&quot;&gt;1&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Access Denied&quot;&lt;/span&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;2&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Not Supported&quot;&lt;/span&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Volume Dirty Bit Is Set&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Not Enough Free Space&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Corrupt Master File Table Detected&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;6&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Call Canceled&quot;&lt;/span&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Call Cancellation Request Too Late&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Defrag Engine Is Already Running&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Unable To Connect To Defrag Engine&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;10&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Defrag Engine Error&quot;&lt;/span&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;11&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Unknown Error&quot;&lt;/span&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9d4be8;&quot;&gt;default&lt;/span&gt; {&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragReport&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;DefragAnalysis}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If the defragmentation process is successful, then the DefragAnalysis object is pipelined to the output, capture it if you wish and process it or &quot;Out-Null&quot; the cmdlet to clean up your Transcript.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&quot;-Force&quot; and &quot;-AnalysisOnly&quot; switch parameters are available and do what you might think they do. &quot;-Force&quot; will cause defragmentation to run even if the volume is low on disk space. &quot;-AnalysisOnly&quot; will only run an analysis and throw the results on the pipeline.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
How about a one-liner to defray volumes that have a file fragmentation level over 10%&lt;br /&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
Get-WmiObject -ComputerName $ComputerName&amp;nbsp; -Class Win32_Volume | ForEach-Object {if ($_ | Process-VolumeDefrag -AnalysisOnly | Where-Object -Property FilePercentFragmentation -eq 0) {$_ | Process-VolumeDefrag} }&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Get the latest and greatest at my &lt;a href=&quot;https://github.com/sushihangover&quot;&gt;GitHub account&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
Set-StrictMode&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;–Version&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;latest&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Process-VolumeDefrag&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2012/2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c:\PS&amp;gt;Process-VolumeDefrag -DriveLetter &quot;c:&quot; -WhatIf&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; What if: Performing operation &quot;Process-VolumeDefrag&quot; on Target &quot;\\MACBOOKPRO\root\cimv2:Win32_Volume.DeviceID=&quot;\\\\?\\Volume{314a1c8f-5921-11e2-be65-806e6f6e6963}\\&quot;&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c:\PS&amp;gt;Get-WmiObject -ComputerName $ComputerName&amp;nbsp; -Class Win32_Volume -Filter (&quot;DriveLetter = &#39;&quot; + $DriveLetter + &quot;&#39;&quot;) | Process-VolumeDefrag -AnalysisOnly&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __GENUS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 1&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __CLASS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Win32_DefragAnalysis&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __SUPERCLASS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __DYNASTY &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Win32_DefragAnalysis&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __RELPATH &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Win32_DefragAnalysis&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __PROPERTY_COUNT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 27&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __DERIVATION&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : {}&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __SERVER&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : MACBOOKPRO&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __NAMESPACE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : ROOT\CIMV2&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __PATH&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : \\MACBOOKPRO\ROOT\CIMV2:Win32_DefragAnalysis&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AverageFileSize &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 43&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AverageFragmentsPerFile &amp;nbsp; &amp;nbsp; &amp;nbsp; : 1&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AverageFreeSpacePerExtent &amp;nbsp; &amp;nbsp; : 36225024&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ClusterSize &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 4096&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ExcessFolderFragments &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FilePercentFragmentation&amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FragmentedFolders &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FreeSpace &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 15105986560&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FreeSpacePercent&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 47&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FreeSpacePercentFragmentation : 23&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LargestFreeSpaceExtent&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 11488489472&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MFTPercentInUse &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 100&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MFTRecordCount&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 155903&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PageFileSize&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalExcessFragments&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalFiles&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 99728&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalFolders&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 4917&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalFragmentedFiles&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalFreeSpaceExtents &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 417&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalMFTFragments &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalMFTSize&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 159645696&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalPageFileFragments&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalPercentFragmentation &amp;nbsp; &amp;nbsp; : 0&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalUnmovableFiles &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 6&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UsedSpace &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 16737165312&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VolumeName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VolumeSize&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 31843151872&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PSComputerName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : MACBOOKPRO&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Medium&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(ParameterSetName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;VolumeObject&#39;&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;System.Management.ManagementBaseObject&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Win32_Volume&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$null&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(ParameterSetName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;DriveLetter&#39;&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DriveLetter&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(ParameterSetName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;DriveLetter&#39;&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ComputerName&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;LocalHost&#39;&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$AnalysisOnly&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Begin&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;Test-IsElevatedUser&lt;span style=&quot;color: black;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;# Win8/2012, must be elevated user, try running defrag.exe to see...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;# via WMI you will get a return of 11 (Unknown Error) vs. a return of 1 (Access Denied)....&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;The storage optimizer cannot start because you have insufficient priveleges to perform this operation. (0x89000024)&#39;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$DefragReport&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$null&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;$Win32_Volume&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$null&lt;span style=&quot;color: black;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$Win32_Volume&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Get-WmiObject&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-ComputerName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$ComputerName&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Class&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;Win32_Volume&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Filter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;DriveLetter = &#39;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$DriveLetter&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&#39;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;Write-Verbose&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Win32_Volume&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Win32_Volume&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$AnalysisOnly&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Win32_Volume&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;defraganalysis()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ReturnValue &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragReport&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;DefragAnalysis&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Force&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$DefragResults&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$Win32_Volume&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;defrag(&lt;/span&gt;$true&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$DefragResults&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$Win32_Volume&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;defrag(&lt;/span&gt;$false&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ReturnValue &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragReport&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;DefragAnalysis&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;switch&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ReturnValue)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;1&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Access Denied&quot;&lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;2&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Not Supported&quot;&lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Volume Dirty Bit Is Set&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Not Enough Free Space&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Corrupt Master File Table Detected&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;6&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Call Canceled&quot;&lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Call Cancellation Request Too Late&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Defrag Engine Is Already Running&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Unable To Connect To Defrag Engine&quot;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;10&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Defrag Engine Error&quot;&lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #942193;&quot;&gt;11&lt;/span&gt; { &lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Unknown Error&quot;&lt;/span&gt; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9d4be8;&quot;&gt;default&lt;/span&gt; {&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragReport&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DefragResults&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;DefragAnalysis}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$DefragReport&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;End&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/7795320438204000940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-optimize-volume-vs-process.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/7795320438204000940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/7795320438204000940'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-optimize-volume-vs-process.html' title='PowerShell : Optimize-Volume vs. Process-VolumeDefrag'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-2792149323490306652</id><published>2013-01-21T21:10:00.000-08:00</published><updated>2013-01-21T21:10:00.628-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="AWS"/><category scheme="http://www.blogger.com/atom/ns#" term="EC2"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Update"/><title type='text'>Installing Windows Updates via PowerShell and Windows Update COM objects</title><content type='html'>There are times when you are working in environments that do not have WSUS installed or you need to do a quick audit/push to install updates via Windows Update. For me, this environment typically is cloud-based (AWS EC2 Windows Instances) as most companies do not back link these environments to their normal auditing routines and system and patch management systems. They SHOULD be running these instances within a VPC and creating a VPN tunnel to link these servers into their internal management systems, but they don&#39;t. Why, why, why... This is a major rant with me at times but I&#39;ll stop for now.&lt;br /&gt;
&lt;br /&gt;
So I pieces together this &#39;Install-WindowsUpdate&#39; function that is a part of my SushiHangover-Tools module to quick audit and install updates remotely.&lt;br /&gt;
&lt;br /&gt;
Create a remote session or run this via am Invoke-Command and supply the &#39;-ListOnly&#39; switch parameter and you will get a list of updates that is not installed (FYI: The return results are PSObjects so you can pipeline the output...)&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Install-WindowsUpdates -ListOnly&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UninstallationNotes :&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Title &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Definition Update for Windows Defender - KB2267602 (Definition 1.143.401.0)&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Description &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Install this update to revise the definition files that are used to detect viruses, spyware, and&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; other potentially unwanted software. Once you have installed this item, it cannot be removed.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SupportUrl&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : http://go.microsoft.com/fwlink/?LinkId=52661&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RebootRequired&amp;nbsp; &amp;nbsp; &amp;nbsp; : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
Note: If you have never worked on these servers before, you might want to include the &#39;-IsHidden&#39; switch parameter in case the prior admin decided to set the hide flag on some updates. Yes, that actually happened to me, an admin was &#39;hidding&#39; the updates and provide his boss with a screen-shot of each server&#39;s Windows Update screen after Patch Tuesday so that he could collect some additional cash for working off-hours and not having to come in the office the &amp;nbsp;next day. Of course they all failed when Microsoft Baseline Security Analyzer (MBSA) was used...&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Cmdlet Bindings of SupportSholdProcess and ConfirmImpact are supported:&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;cmdletbinding&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;(SupportsShouldProcess&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;ConfirmImpact&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;&quot;High&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Install-WindowsUpdates -WhatIf&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; What if: Performing operation &quot;Install-WindowsUpdates&quot; on Target &quot;Download 1 Windows Update Package(s)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;C:\PS&amp;gt;Install-WindowsUpdates -Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Install-WindowsUpdates&quot; on Target &quot;Download 1 Windows Update Package(s)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Install-WindowsUpdates&quot; on Target &quot;Install Definition Update for Windows Defender - KB2267602&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Definition 1.143.401.0)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Have fun and get the latest at my &lt;a href=&quot;https://github.com/sushihangover&quot;&gt;GitHub account.&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
Set-StrictMode&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;–Version&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;latest&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Install-WindowsUpdates&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Get and optionally install Windows Updates&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This script will get all available udpates for the computer it is run on.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; It will then optionally install those updates, provided they do not require&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user input.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This script was based off the original vbs that appeared on the MSDN site.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Please see the Related Links section for the URL.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Without any parameters the script will return the title of each update that&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; is currently available.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .PARAMETER Install&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; When present the script will download and install each update. If the EulaAccept&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; param has not been passed, only updates that don&#39;t have a Eula will be applied.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .PARAMETER EulaAccept&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; When present will allow the script to download and install all updates that are&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currently available.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Install-WindowsUpdates -ListOnly&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UninstallationNotes :&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Title &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Definition Update for Windows Defender - KB2267602 (Definition 1.143.401.0)&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Description &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Install this update to revise the definition files that are used to detect viruses, spyware, and&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; other potentially unwanted software. Once you have installed this item, it cannot be removed.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SupportUrl&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : http://go.microsoft.com/fwlink/?LinkId=52661&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RebootRequired&amp;nbsp; &amp;nbsp; &amp;nbsp; : False&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Install-WindowsUpdates -WhatIf&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; What if: Performing operation &quot;Install-WindowsUpdates&quot; on Target &quot;Download 1 Windows Update Package(s)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Install-WindowsUpdates -Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Install-WindowsUpdates&quot; on Target &quot;Download 1 Windows Update Package(s)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Install-WindowsUpdates&quot; on Target &quot;Install Definition Update for Windows Defender - KB2267602&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Definition 1.143.401.0)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://msdn.microsoft.com/en-us/library/windows/desktop/aa387102(v=vs.85).aspx&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;High&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(mandatory&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;$false&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;$RebootIfRequired&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(mandatory&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;$false&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;$IncludeHidden&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ListOnly&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Begin&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$ScriptName&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$MyInvocation&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyCommand&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Name&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$Username&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$env:USERDOMAIN&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;\&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$env:USERNAME&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;Test-IsElevatedUser&lt;span style=&quot;color: black;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-EventLog&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-Source&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ScriptName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-LogName&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Windows Powershell&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-ErrorAction&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;SilentlyContinue&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Message&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Script: &quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ScriptName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;`nScript User: &quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Username&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;`nStarted: &quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Get-Date&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;toString()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-EventLog&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-LogName&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Windows Powershell&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-Source&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ScriptName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-EventID&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;104&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-EntryType&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Information&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-Message&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Message&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateSession&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-ComObject&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Microsoft.Update.Session&#39;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateSession&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ClientApplicationID &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Install Windows Updates via PowerShell&#39;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$ReBootRequired&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$false&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateSearcher&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateSession&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;CreateUpdateSearcher()&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$SearchQuery&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;IsInstalled=0 and Type=&#39;Software&#39;&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$IncludeHidden&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$SearchQuery&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39; and IsHidden=0&#39;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;try&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$SearchResult&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$UpdateSearcher&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Search(&lt;/span&gt;$SearchQuery&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;# [Exception from HRESULT: 0x8024402C] {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ListOnly&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;ForEach&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt; &lt;span style=&quot;color: #011b9d;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$SearchResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Updates) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-TypeName&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;PSObject&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Property&lt;/span&gt; @{&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Title &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Title; Description &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Description; SupportUrl &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;SupportUrl;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UninstallationNotes &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;UninstallationNotes; RebootRequired &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;RebootRequired}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;elseif&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$SearchResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Updates&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Count &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-ne&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;Test-IsElevatedUser&lt;span style=&quot;color: black;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Creating a collection of updates to download:&#39;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToDownload&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-ComObject&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Microsoft.Update.UpdateColl&#39;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;ForEach&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt; &lt;span style=&quot;color: #011b9d;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$SearchResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Updates) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$addThisUpdate&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;InstallationBehavior&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;CanRequestUserInput) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;&amp;gt; Skipping: &lt;span style=&quot;color: black;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Title)&lt;/span&gt; because it requires user input&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;elseif&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;EulaAccepted &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Title &lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot; has a license agreement that must be accepted:&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;AcceptEula()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$addThisUpdate&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;&amp;gt; Skipping: &lt;span style=&quot;color: black;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Title)&lt;/span&gt; because the license agreement was declined&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$addThisUpdate&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$addThisUpdate&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Adding: &lt;/span&gt;$(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Title)&lt;span style=&quot;color: #9e1300;&quot;&gt; to download list&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToDownload&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Add(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;) &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Out-Null&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToDownload&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Count &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-ne&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$DLCount&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToDownload&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Count&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Download &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DLCount&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt; Windows Update Package(s)&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Downloading updates...&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Downloader&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateSession&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;CreateUpdateDownloader()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Downloader&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Updates &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToDownload&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Downloader&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Download() &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Out-Null&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToInstall&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-ComObject&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Microsoft.Update.UpdateColl&#39;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$rebootMayBeRequired&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$false&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Installer&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateSession&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;CreateUpdateInstaller()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt; &lt;span style=&quot;color: #011b9d;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$SearchResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Updates) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateTitle&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Title&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsDownloaded) {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Successfully downloaded &amp;amp; ready to install : (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateTitle&lt;/span&gt;)&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToInstall&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Add(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;) &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Out-Null&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Update&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;InstallationBehavior&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;RebootBehavior &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-gt&lt;/span&gt; &lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$rebootMayBeRequired&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Installer&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Updates &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToInstall&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Install &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateTitle&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Installing &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateTitle&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$InstallationResult&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Installer&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Install()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$InstallationResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;RebootRequired) {&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$ReBootRequired&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Installation Result: &lt;/span&gt;$(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$InstallationResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ResultCode)&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Reboot Required: &lt;/span&gt;$(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$InstallationResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;RebootRequired)&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Listing of updates installed and individual installation results&#39;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #942193;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-lt&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToInstall&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Count; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;++&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-TypeName&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;PSObject&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Property&lt;/span&gt; @{&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Title &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdateTitle&lt;/span&gt;; Result &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$InstallationResult&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ResultCode}&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$UpdatesToInstall&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Clear()&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Elevated user required for installation&quot;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Verbose&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;No updates are available&quot;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;End&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Message&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Script: &quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ScriptName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;`nScript User: &quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Username&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;`nFinished: &quot;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Get-Date&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;toString()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-EventLog&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-LogName&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Windows Powershell&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-Source&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$ScriptName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-EventID&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;104&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-EntryType&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Information&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-Message&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Message&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;$ReBootRequired&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;-and&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$RebootIfRequired&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;IsPresent) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;Restart-Computer&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-Force&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/2792149323490306652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/installing-windows-updates-via.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2792149323490306652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2792149323490306652'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/installing-windows-updates-via.html' title='Installing Windows Updates via PowerShell and Windows Update COM objects'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-4302134627408706037</id><published>2013-01-20T18:06:00.000-08:00</published><updated>2013-01-26T10:21:00.668-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Fusion"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="VMWare"/><title type='text'>PowerShell : Disabling WSearch (Windows Search Indexer)</title><content type='html'>&lt;br /&gt;
&lt;div&gt;
Call me lazy, but I get tried of typing the cmds to stop and disable the Windows Search Indexer (WSearch). A lot of my Windows 8 client &#39;desktops&#39; &amp;nbsp;are VM based and I have no patience for the pauses/stuttering during PowerShell typing on these jump boxes to AWS, Azure and VPN based data centers... but I can this problem on dedicated laptops also, have since they introduced the feature... Not sure why it can not run as smoothly as OS-X&#39;s Spotlight indexing...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Note: I have also found that the &#39;WSearch&#39; can cause a Fusion based VM to start consuming 100% of the vmware-vmx service on your OS-X box, but than again, there are a lot of issues regarding the vmware-vmx service and 100% cpu usage and have been for years:&amp;nbsp;&lt;a href=&quot;http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=1027723&quot; target=&quot;_blank&quot;&gt;Troubleshooting a Fusion virtual machine that uses 100% of the Mac&#39;s CPU&lt;/a&gt;&amp;nbsp;. I am getting very tried of this issue as it has been popping up in ever Windows 8 VM that I have created, no reason that I can find, no strange software installed on the VM, some are clean installs with NO extra software install and no shared directories with the host, just using it as a WinRM client, looks like it is time to jump ship for Parallels and see if I can but this issue behind me...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3xYh37DXUr_P__0ZYwAu_zXFK7mOVNgCTTossRFY5cAHV9YQ47RCktwYvphGvR1Xl2H85bH8ocepIgfbigaqkwk6GfO5IBeh5umvP2prFFnxtuvn3Za4wT8bVdOU1pU9dCuUtHrzsmLQ/s1600/Screen+Shot+2013-01-26+at+10.18.02+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3xYh37DXUr_P__0ZYwAu_zXFK7mOVNgCTTossRFY5cAHV9YQ47RCktwYvphGvR1Xl2H85bH8ocepIgfbigaqkwk6GfO5IBeh5umvP2prFFnxtuvn3Za4wT8bVdOU1pU9dCuUtHrzsmLQ/s400/Screen+Shot+2013-01-26+at+10.18.02+AM.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;span id=&quot;goog_488621109&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
As Always get the latest and greatest at my&amp;nbsp;&lt;a href=&quot;https://github.com/sushihangover&quot;&gt;GitHub account&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
Set-StrictMode&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;–Version&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;latest&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: #011b9d;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Disable-WindowsSearch&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #007400;&quot;&gt;&amp;lt;#&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .NOTES&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright 2012/2013 Robert Nees&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .SYNOPSIS&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Stop and Set the Windows Search Indexer to disabled&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .DESCRIPTION&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Call me lazy, I get tried of typing the cmds to stop and disable the&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WSearch Service on the Windows 8 machines I touch.... I use them as jumpboxes&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to AWS, Azure, VPN based datacenters and the pauses during the indexing of scripts, transcripts,&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drives me insane...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .EXAMPLE&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Disable-WindowsSearch -Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Disable-WindowsSearch&quot; on Target &quot;System.ServiceProcess.ServiceController&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Stop-Service&quot; on Target &quot;Windows Search (WSearch)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WARNING: Waiting for service &#39;Windows Search (WSearch)&#39; to stop...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WARNING: Waiting for service &#39;Windows Search (WSearch)&#39; to stop...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WARNING: Waiting for service &#39;Windows Search (WSearch)&#39; to stop...&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Set-Service&quot; on Target &quot;Windows Search (WSearch)&quot;.&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;): y&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://sushihangover.blogspot.com&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; .LINK&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; https://github.com/sushihangover&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; #&amp;gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(Mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$false&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;switch&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Enable&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Begin&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Get-Service&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Name&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;WSearch&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #b8b8b8;&quot;&gt;!&lt;/span&gt;(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Enable&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;IsPresent)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Status &lt;span style=&quot;color: #b8b8b8;&quot;&gt;-eq&lt;/span&gt; &lt;span style=&quot;color: #9e1300;&quot;&gt;&#39;Running&#39;&lt;/span&gt;) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Stop-Service&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-Force&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Set-Service&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-StartupType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Disable&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;span style=&quot;color: #011b9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Set-Service&lt;/span&gt; &lt;span style=&quot;color: #011993;&quot;&gt;-StartupType&lt;/span&gt; &lt;span style=&quot;color: #9d4be8;&quot;&gt;Automatic&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$Service&lt;/span&gt; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #0433ff;&quot;&gt;Start-Service&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;End&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/4302134627408706037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-disabling-wsearch-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/4302134627408706037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/4302134627408706037'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-disabling-wsearch-windows.html' title='PowerShell : Disabling WSearch (Windows Search Indexer)'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3xYh37DXUr_P__0ZYwAu_zXFK7mOVNgCTTossRFY5cAHV9YQ47RCktwYvphGvR1Xl2H85bH8ocepIgfbigaqkwk6GfO5IBeh5umvP2prFFnxtuvn3Za4wT8bVdOU1pU9dCuUtHrzsmLQ/s72-c/Screen+Shot+2013-01-26+at+10.18.02+AM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-3237364229643074777</id><published>2013-01-18T22:30:00.000-08:00</published><updated>2013-01-18T22:30:00.812-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="AWS"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="RSA"/><category scheme="http://www.blogger.com/atom/ns#" term="RSACrypto"/><category scheme="http://www.blogger.com/atom/ns#" term="SushiHangover-Tools"/><category scheme="http://www.blogger.com/atom/ns#" term="Tools"/><category scheme="http://www.blogger.com/atom/ns#" term="Transcript"/><title type='text'>SushiHangover-Tools : Three different modules...</title><content type='html'>There are currently three different modules within the Tools Repository. The RSACypto and Transcripts module are not being merged into the core Tools module as there are people using these independently from Tools.&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;js-slide-to css-truncate-target&quot; href=&quot;https://github.com/sushihangover/SushiHangover-PowerShell/tree/master/modules/SushiHangover-RSACrypto&quot; id=&quot;889ef576beba55167e75ae1b7adf5697-5ccc4f34f0b51690a641c99b3ac133d800a0ab4c&quot; style=&quot;border: 0px; color: #4183c4; display: inline-block; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;&quot; title=&quot;SushiHangover-RSACrypto&quot;&gt;SushiHangover-RSACrypto&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;js-slide-to css-truncate-target&quot; href=&quot;https://github.com/sushihangover/SushiHangover-PowerShell/tree/master/modules/SushiHangover-Transcripts&quot; id=&quot;f7f7a1cad775403165d8367cb9238363-36065ef9a0fe114f450650d83ec08554c9a69014&quot; style=&quot;border: 0px; color: #4183c4; display: inline-block; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;&quot; title=&quot;SushiHangover-Transcripts&quot;&gt;SushiHangover-Transcripts&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;js-slide-to css-truncate-target&quot; href=&quot;https://github.com/sushihangover/SushiHangover-PowerShell/tree/master/modules/SushiHangover-Tools&quot; id=&quot;f6867b3019a45a990845468aacde9a3e-2dad1dce9d52f76f70890aaf075044d9115b25f2&quot; style=&quot;border: 0px; color: #4183c4; display: inline-block; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; margin: 0px; max-width: 100%; overflow: hidden; padding: 0px; text-overflow: ellipsis; vertical-align: top; white-space: nowrap;&quot; title=&quot;SushiHangover-Tools&quot;&gt;SushiHangover-Tools&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
SushiHangover-Transcripts is not required to be Imported to use the AWS modules, but RSACrypto will be auto-imported when needed. Tools currently is a loaded upon AWS import, but that might (should) change to loaded on demand...&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;As always get the latest at my&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://github.com/sushihangover&quot; style=&quot;background-color: #141414; color: #f1c232; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;GitHub account&lt;/a&gt;&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/3237364229643074777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/sushihangover-tools-three-different.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/3237364229643074777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/3237364229643074777'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/sushihangover-tools-three-different.html' title='SushiHangover-Tools : Three different modules...'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-3193653228714290655</id><published>2013-01-16T20:46:00.000-08:00</published><updated>2013-01-17T13:53:49.286-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="CDROM"/><category scheme="http://www.blogger.com/atom/ns#" term="Flash Drive"/><category scheme="http://www.blogger.com/atom/ns#" term="Media"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="SushiHangover-Tools"/><title type='text'>Not using &quot;$pscmdlet.ShouldProcess&quot;?, then you are doing it wrong!... </title><content type='html'>If you are not using the cmdlet binding of &quot;SupportsShouldProcess&quot; in cmdlets/functions, than you are doing it wrong...&lt;br /&gt;
&lt;br /&gt;
The ease of adding support for the &#39;-Confirm&#39; and &#39;-Whatif&#39; is just waaaayyyyy too easy, and provides to much power not to be used.&lt;br /&gt;
&lt;br /&gt;
Personally I feel if your script is going to change ANYTHING on one system, let alone hundreds of them at one time, you have to(!) to include WhatIf processing. Confirmations, setting the Confirmation level in a script and in your environment are another thing, but I will save that for a rant at a later date.&lt;br /&gt;
&lt;br /&gt;
Lets take a very simple example where I am ejecting/dismounting removable media from PowerShell to show how easy it really is to add -Confirm and -WhatIf to your function.&lt;br /&gt;
&lt;br /&gt;
Let start by adding the following line after your function name, but before you start describing the parameters for that function.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
This automatically allows -Whatif and -Confirm switches to be sent to your function. In this line I am also setting the Confirm Impact level to be low since ejecting removable media is usually not very dangerous as Windows will not allow the dismount to be processed if the device drive is &#39;busy&#39; due to exclusive file locks that are associated with that media, and it will properly flush any cached writes and &#39;close/dismount&#39; the device properly so that it can be physically removed.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;FYI: Information Systems risk analysis should be reviewed and applied to PowerShell routines and setting the ConfirmImpact level with intelligence is one of those of those areas...&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Now that I can accept Whatif/Confirm, just what do I do? Well you use the&amp;nbsp;&lt;span style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;ShouldProcess&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;&amp;nbsp;&lt;/span&gt;function to provide the output for the -Whatif and -Confirm. In this example I am passing in the Media Drives &#39;Device ID&#39; so the ShouldProcess routing will display it:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Helvetica;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DeviceID&lt;/span&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$ShellApplication&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Namespace(&lt;span style=&quot;color: #942193;&quot;&gt;17&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ParseName(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DeviceID&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;InvokeVerb(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Eject&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Pass in the -Confirm switch to this function now and you get the following output:&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black; font-family: Helvetica;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C:\PS&amp;gt;Do-Eject.ps1 E: -Confirm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Confirm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you sure you want to perform this action?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Performing operation &quot;Dismount-RemovableMedia&quot; on Target &quot;a:&quot;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Y] Yes&amp;nbsp; [A] Yes to All&amp;nbsp; [N] No&amp;nbsp; [L] No to All&amp;nbsp; [S] Suspend&amp;nbsp; [?] Help (default is &quot;Y&quot;):&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Pass in the -Whatif switch and you get:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black; font-family: Helvetica;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:\PS&amp;gt;Dismount-RemovableMedia a: -whatif&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; What if: Performing operation &quot;Dismount-RemovableMedia&quot; on Target &quot;a:&quot;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
How can you not love that for the amount of afford that went into it...&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The full function now handles Whatif and Confirm, along with the ability to pipe by Device IDs, objects such are &#39;win32_LogicalDisk&#39; object and of course, just passing in the drive letter. All this and the function only has a few lines of maintainable code and is now a true PowerShell citizen (the one in Github has comment based help also ;-)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Helvetica; font-size: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #011b9d;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Dismount-RemovableMedia&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;cmdletbinding&lt;/span&gt;(SupportsShouldProcess&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$True&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ConfirmImpact&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Low&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Param&lt;/span&gt; (&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b8b8b8;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;parameter&lt;/span&gt;(mandatory&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipeline&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;,&lt;/span&gt;ValueFromPipelineByPropertyName&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$true&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #00cbff;&quot;&gt;Alias&lt;/span&gt;(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Drive&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #009193;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DeviceID&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;Begin&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$ShellApplication&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;New-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-comObject&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;Shell.Application&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;color: #011b9d; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;Process&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #ff5d00;&quot;&gt;$pscmdlet&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ShouldProcess(&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DeviceID&lt;/span&gt;)) {&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff5d00;&quot;&gt;$ShellApplication&lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;Namespace(&lt;span style=&quot;color: #942193;&quot;&gt;17&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;ParseName(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$DeviceID&lt;/span&gt;&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;&lt;/span&gt;)&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;InvokeVerb(&lt;span style=&quot;color: #9e1300;&quot;&gt;&quot;Eject&quot;&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #011b9d;&quot;&gt;End&lt;/span&gt; {&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;$ShellApplication&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$null&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;Remove-ComObjectsFromMemory&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
}&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Review the help for the rest of the Cmdlet Binding attributes as the paging attribute can come in quite handy also...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;; text-align: center;&quot;&gt;man&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; text-align: center;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;; text-align: center;&quot;&gt;about_Functions_CmdletBindingAttribute&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;; text-align: center;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;; text-align: center;&quot;&gt;-ShowWindow&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Or start here for some basic information from the &lt;a href=&quot;http://blogs.technet.com/b/heyscriptingguy&quot;&gt;Scripting Guy&lt;/a&gt;:&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
&lt;span style=&quot;font-family: inherit; font-size: small;&quot;&gt;&lt;a href=&quot;http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/07/weekend-scripter-cmdletbinding-attribute-simplifies-powershell-functions.aspx&quot;&gt;Weekend Scripter: Cmdletbinding Attribute Simplifies PowerShell Functions&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/3193653228714290655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/not-using-pscmdletshouldprocess-then.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/3193653228714290655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/3193653228714290655'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/not-using-pscmdletshouldprocess-then.html' title='Not using &quot;$pscmdlet.ShouldProcess&quot;?, then you are doing it wrong!... '/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-2540071872464778171</id><published>2013-01-14T21:12:00.000-08:00</published><updated>2013-01-15T07:26:02.563-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Credentials"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell: Saving and Reloading Windows Credentials</title><content type='html'>Many PowerShell cmdlets accept the parameter &quot;-Credential&quot; in order to perform their magic on local and remote servers. A fairly standard way of doing this is to use Get-Credential inline with the other cmdlet parameters ie: &quot;-Credential (Get-Credential)&quot; This will cause the a Windows Cred/Login Input form to pop-up and stop script execution till you complete it.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy4FqghI5Eyjlw10kuqLDMxTp_NaD-9sQogIR3j1CS0bzFYw06edL0kzU4DT6reNiwWywdXaFkh8zVY2R5g-0BTz0oykmvcJaHQAYzohctVsznSmiuzCMO8xcU25KN1kgalIYjSAwda_8/s1600/Screen+Shot+2013-01-13+at+5.24.49+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy4FqghI5Eyjlw10kuqLDMxTp_NaD-9sQogIR3j1CS0bzFYw06edL0kzU4DT6reNiwWywdXaFkh8zVY2R5g-0BTz0oykmvcJaHQAYzohctVsznSmiuzCMO8xcU25KN1kgalIYjSAwda_8/s320/Screen+Shot+2013-01-13+at+5.24.49+PM.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Thus the &lt;b&gt;Export-Credential&lt;/b&gt; and &lt;b&gt;Import-Credential&lt;/b&gt; functions were written.&lt;br /&gt;
&lt;br /&gt;
Most uses of the Import-credential / Export-Credential involve automating scripts that require elevated permissions or scripts that need to be scheduled but require different credentials&amp;nbsp;than one from the scheduler&#39;s process credentials.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Start with the Export-Credential cmdlet as you will need the CLIXML based file that it creates in order to use the Import-Credential cmdlet.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Try the following and you will see what is stored in the CLXML file:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;c:\PS&amp;gt;;Get-Credential |Export-Credential -Path &#39;DeleteMe.clixml&#39; ; cat DeleteMe.clixml ; rm DeleteMe.clixml&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;t style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;System.Management.Automation.PSCustomObject&lt;/t&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;t&gt;System.Object&lt;/t&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;ms&gt;&lt;/ms&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span n=&quot;UserName&quot;&gt;NotTheAdminUser&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span n=&quot;Password&quot;&gt;01000000d08c9ddf0115d1118c7a00c04fc297eb01000000a9c3a4e550e9274a9c69bdcd573b532100000000020000000&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #007400; font-family: &#39;Lucida Console&#39;; font-size: 9px;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Note: The Password is stored as a encrypted string, this string will be converted to a SecureString upon import so it will comply with the SecureString member of the PSCredential object.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Run the Export-Credential again, but lets actually save it this time:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;c:\PS&amp;gt;Get-Credential |Export-Credential -Path &#39;ExchangeServiceAccountLogin.clixml&#39;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Now when you need to supply this Exchange Service Account&#39;s credentials within the processes of some cmdlet in your script, you can just do something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #007400;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b style=&quot;font-family: Helvetica;&quot;&gt;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;$ExoCred = Import-Credential -Path &#39;DeleteMe.clixml&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400;&quot;&gt;
&lt;span style=&quot;font-family: inherit; font-size: x-small;&quot;&gt;&amp;nbsp; $NewSession = New-PSSession -Credential $EXOCred -ComputerName &quot;mail.sushihangover.com&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #007400;&quot;&gt;
&lt;span style=&quot;font-family: inherit; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #345220; font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 10px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-family: Times; font-size: small; white-space: normal;&quot;&gt;Remember with great power, comes great responsibility:&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;Note: SecureString encryption, without passing in a key value, would be using a &#39;key&#39; from the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;current user (you!) to encrypt these strings and thus anyone that can log as you (co-worker,&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;&amp;nbsp; ex-girlfriend, hacker, ...) could use these saved Credentials...&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;Note: This function accepts using a SecureString as a Key for the encryption. Review the SecureString&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;help to determine usage. It is your respondibility to protext that Key (Please do not enter and save it&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;your script(!!!) as you might as well used Clear Text to begin with)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;Note: ConfirmImpact = High? Yes, you are saving a user&#39;s credentials to a file. Even though t&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;his is using Secure Strings in PowerShell you still need to be aware that is can be a&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;security risk and that a file with credentials will now exist.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;Note: If are working in a &#39;secure&#39; computing environment, I would highly recommend you not use&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;these functions, a RSA SSL cert based encryption and decryption based system would be the correct&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;way to deliver functions like these. In case of suspect access, you can revoke the SSL cert and those&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: inherit;&quot;&gt;saved cred would be null and void to the hacker.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;As always get the latest at my&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://github.com/sushihangover&quot; style=&quot;background-color: #141414; color: #f1c232; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;GitHub account&lt;/a&gt;&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/2540071872464778171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-saving-and-reloading-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2540071872464778171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2540071872464778171'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-saving-and-reloading-windows.html' title='PowerShell: Saving and Reloading Windows Credentials'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy4FqghI5Eyjlw10kuqLDMxTp_NaD-9sQogIR3j1CS0bzFYw06edL0kzU4DT6reNiwWywdXaFkh8zVY2R5g-0BTz0oykmvcJaHQAYzohctVsznSmiuzCMO8xcU25KN1kgalIYjSAwda_8/s72-c/Screen+Shot+2013-01-13+at+5.24.49+PM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-404615346218869284</id><published>2013-01-13T21:32:00.000-08:00</published><updated>2013-01-14T07:35:43.454-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="founder"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="startup"/><category scheme="http://www.blogger.com/atom/ns#" term="xkcd"/><category scheme="http://www.blogger.com/atom/ns#" term="xkcd.com"/><title type='text'>xkcd? What do you mean you never heard of it...</title><content type='html'>I was coding an automation project at my favorite place in the world recently (hint: there is a geocache there and it involves some of the best coffee in Seattle) and ended up talking to a table sharing nerd/geek who happened to be a founder of a new tech startup about the pro and cons of certain code frameworks, AWS Cloud deployments, coding and building scalable systems from the get-go, etc... During this conversation I rattled references to &#39;xkcd&#39; multiple times and he would just nod his head in agreement...&lt;br /&gt;
&lt;br /&gt;
Since they are running in &#39;stealth mode&#39; right now, he had his web developer, who was at another table, updating a countdown timer on the home page of their new site, but with the project timeline moving around they needed to determine a real life date/time that the site&#39;s features would go live or remove it totally from the design. Me, being me, I said just &quot;xkcd SuperVolcano Countdown&quot; that timer, done deal, and you can forget about it. Blank stares from both guys, I mean really blank...clueless, out to lunch, over the head, going going gone...&lt;br /&gt;
&lt;br /&gt;
The founder finally said what is a SuperVolcano Countdown function? is that a server side routine? The WebDev than asked which JavaScript framework was it in? was it mobile compliant? I replied no, no, no, no, nooooo. It is a WebComic, more blank stares were returned...&lt;br /&gt;
&lt;br /&gt;
The net of the story is their web site now has a picture hanging over their web site release timer:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img alt=&quot;http://xkcd.com/1159/&quot; border=&quot;0&quot; height=&quot;251&quot; src=&quot;http://imgs.xkcd.com/comics/countdown.png&quot; title=&quot;&quot; width=&quot;640&quot; /&gt;&lt;a href=&quot;http://xkcd.com/1159/&quot;&gt;http://xkcd.com/1159/&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Personally, I am now going to have to commit to adding a &quot;SuperVolcano Countdown&quot; style javascript/css framework/class to the open source community (Copyright and Patent Pending, of course!).&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
FYI: I have seen a old NYTimes&amp;nbsp;article (2008) placing &lt;a href=&quot;http://xkcd.com/&quot;&gt;xkcd.com&lt;/a&gt; numbers at 500k unique visitors per day. Would love to know what his unique visitor count per month is now (2013), but if you have never heard of xkcd, then shame on you, bookmark it, RSS feed it, &amp;amp; Home page it, buy one of his T-Shirts to allow the ex-NASA robot dude to continue providing me a true laugh a couple of times a week, &lt;b&gt;or never ask me to work at OR fund your tech startup.... ;&lt;/b&gt;-)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/404615346218869284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/xkcd-what-do-you-mean-you-never-heard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/404615346218869284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/404615346218869284'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/xkcd-what-do-you-mean-you-never-heard.html' title='xkcd? What do you mean you never heard of it...'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total><georss:featurename>Seattle, WA, USA</georss:featurename><georss:point>47.6062095 -122.3320708</georss:point><georss:box>47.263683 -122.9775178 47.948736 -121.68662379999999</georss:box></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-8155464107868842912</id><published>2013-01-12T19:19:00.000-08:00</published><updated>2013-01-12T19:19:00.632-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="SushiHangover-Tools"/><title type='text'>SushiHangover-Tools : The Move has begin...</title><content type='html'>I have started moving my misc. cmdlets into a new module called SushiHangover-Tools in order to support my AWS module (SushiHangover-AWS) which will auto-import the tools when needed.&lt;br /&gt;
&lt;br /&gt;
The new directory/module name is Modules/SushiHangover-Tools&amp;nbsp;and all the tools within that module will be loaded via the new manifest file (SushiHangover-Tools.psd1).&lt;br /&gt;
&lt;br /&gt;
If you have never used a manifest file for your modules, it is really easy, they can be created via the &quot;New-ModuleManifest&quot; or edited in the ISE... Of course there is a &quot;Test-ModuleManifest&quot; to check that are you files are available in the paths described within the manifest.&lt;br /&gt;
&lt;br /&gt;
The best place to start when you wish create a manifest of your own is at Microsoft&#39;s Dev Center :&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/dd878337(v=vs.85).aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/dd878337(v=vs.85).aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
As always get the latest at my &lt;a href=&quot;https://github.com/sushihangover&quot;&gt;GitHub account&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/8155464107868842912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/sushihangover-tools-move-has-begin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8155464107868842912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8155464107868842912'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/sushihangover-tools-move-has-begin.html' title='SushiHangover-Tools : The Move has begin...'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-6688598159476069905</id><published>2013-01-10T20:14:00.000-08:00</published><updated>2013-01-10T20:14:00.600-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="AWS"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell and all the AWS modules; a status update</title><content type='html'>Some of you might be looking for the updated AWS modules (EC2, S3, RDS, SQS, etc...) and are scratching your head when looking in GitHub. As some users of the SushiHangover-AWS have &#39;alpha/beta&#39; releases that never made it into the &lt;b&gt;public&lt;/b&gt; repositories, I have received a bunch of emails regrading status so I thought I would a public post.&lt;br /&gt;
&lt;br /&gt;
Yes, the modules are still open source and not going away and will be re-released under the new module structure. I have been really busy in &#39;real life&#39; (you know, the one that we have away from the keyboard and glowing LCD screens ;-) and have not gotten time to test and push the updates/changes to the new module structure that I created.&lt;br /&gt;
&lt;br /&gt;
Testing is the biggest hold up, if there are people willing to write Unit Tests for one or more AWS services, or just a series cmdlet tests for one AWS service that can be chained into the PSUnit let me know. Also if others wish to add code to the modules, versus asking me to code them new feature, let me know via GitHub.&lt;br /&gt;
&lt;br /&gt;
Also if you REALLY REALLY REALLY need that new feature for your new project/product rollout and can not code it yourself, I can always adjust my priorities in trade for cash, but beware, I might be easy, but I am not cheap... :-0&lt;br /&gt;
&lt;br /&gt;
Thanks...</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/6688598159476069905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-and-all-aws-modules-status.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/6688598159476069905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/6688598159476069905'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-and-all-aws-modules-status.html' title='PowerShell and all the AWS modules; a status update'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-856528708036400303</id><published>2013-01-08T19:44:00.000-08:00</published><updated>2013-01-11T12:37:22.848-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="EC2"/><category scheme="http://www.blogger.com/atom/ns#" term="Encryption"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="RSA"/><category scheme="http://www.blogger.com/atom/ns#" term="Text Encoding"/><title type='text'>PowerShell: RSA Private Key based Encrypt and Decrypt (update)</title><content type='html'>Update to original post:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I have done a number of &amp;nbsp;encryption/decryption routines in my past coding experiences, and normally like to take advantage of proven techniques and so does Amazon ;-)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Amazon publishes the Window Administrator&#39;s password that are randomly generated upon AMI to Instance creation in Base64 format that have been encrypted using the SSL private key that was associated to the instance. The AWS web console interface provides an interactive way to retrieve and decrypt this password using your local private key file using RSA PKCS#1 v1.5 padded format, but GUI&#39;s are for wimps, so I wanted to use the AWS SDK to retrieve and decrypt the password.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Originally this code was buried inside my AWS modules and using it meant setting up AWS....duh...&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I moved it to its own module and so you can build your own private encyption and decryption routines. The UnitTest-RSACrypto.ps1 script shows the stand-alone usage of the code.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;;&quot;&gt;Import-Module&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Lucida Console&#39;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;;&quot;&gt;SushiHangover-RSACrypto&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$PemFile&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$HOME&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;\.ssh\SSH2RSA2048_private_test_key.pem&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;Set-RSACryptoServiceProvider&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$PemFile&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$preclearText&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&quot;Hello, Lets keep this a secret, OK?&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Clear Text of:&#39;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;--------------&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$preclearText&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-ForegroundColor&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;Green&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;Write-Host&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;$preclearBytes&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Convert-StringToByte&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$preclearText&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;$clearBase64&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;ConvertTo-Base64String&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$preclearBytes&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;$cypherBytes&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Get-RSAEncryptedBytes&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$clearBase64&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$false&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;$cypherBase64&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;ConvertTo-Base64String&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$cypherBytes&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Encrypted Base64 String:&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;------------------------&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$cypherBase64&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;-ForegroundColor&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9d4be8;&quot;&gt;Red&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;Write-Host&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Compare-Object output using input bytes via Get-RSAClearBytes:&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;$postclearBytes&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Get-RSAClearBytes&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$cypherBase64&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$false&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #011993; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Compare-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$preclearBytes&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ff5d00;&quot;&gt;$postclearBytes&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-CaseSensitive&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-IncludeEqual&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Format-Table&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;-AutoSize&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9e1300; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Write-Host&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&#39;Compare-Object output using clear text input via Get-RSAClearText:&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;$postclearText&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b8b8b8;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Get-RSAClearText&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$cypherBase64&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$false&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0433ff; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;Write-Host&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #ff5d00; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Compare-Object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$preclearText&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;$postclearText&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-CaseSensitive&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #011993;&quot;&gt;-IncludeEqual&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #9d4be8; font-family: &#39;Lucida Console&#39;;&quot;&gt;
&lt;span style=&quot;background-color: black; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #0433ff;&quot;&gt;Remove-Module&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;SushiHangover-RSACrypto&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Lucida Console&#39;; font-size: 9px; min-height: 9px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
FYI: This module&#39;s functions are now called via the &#39;Get-EC2Password&#39; cmdlet in the &#39;SushiHangover-AWS&#39; module to get the admin password within AWS EC2 Windows based Instances.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;As always get the latest version at my&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://github.com/sushihangover&quot; style=&quot;background-color: #141414; color: #f1c232; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;&quot;&gt;GitHub&lt;/a&gt;&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #141414; color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/856528708036400303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-rsa-private-key-based.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/856528708036400303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/856528708036400303'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2013/01/powershell-rsa-private-key-based.html' title='PowerShell: RSA Private Key based Encrypt and Decrypt (update)'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-2119860865876938154</id><published>2012-10-28T19:10:00.001-07:00</published><updated>2012-10-29T19:03:37.964-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell : Console logging via Transcripts</title><content type='html'>I recently &#39;found&#39; the cmdlets for starting and stopping transcripts.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Start-Transcript (Creates a record of a Windows PowerShell session in a text file)&lt;/li&gt;
&lt;li&gt;Stop-Transcript (Stops a transcript)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
So I instantly added a &quot;Start-Transcript&quot; to my Profile as I have been saving my command history in various ways but capturing console output has been a pain. Somethings I &#39;cook&#39; saving the output right into my scripts by using the &#39;Tee-Output&#39; cmdlet, but I forget sometimes (well...most of the time) and later want to document what I did and only have some of the information, well no more...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
BUT WAIT... the big thing with Transcripts is that they are live, not buffered, text files and if you grep the active one you are going to be put into an endless loop, and ALSO there is no Suspend-Transcript or Resume-Transcript, just start and stop. I did a really quick set of functions to handle initialing my transcript path and file naming convention (i.e: &quot;Transcript-2012-10-26-1634-PID2428.log&quot;) so each and every session started gets a unique transcript log based upon the date, time and session process id.&lt;/div&gt;
&lt;br /&gt;
So now I have the following functions in the module:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Initialize-TranscriptLocation&lt;/li&gt;
&lt;li&gt;Initialize-Transcript&lt;/li&gt;
&lt;li&gt;Resume-Transcript&lt;/li&gt;
&lt;li&gt;Suspend-Transcript&lt;/li&gt;
&lt;li&gt;Show-Transcript&lt;/li&gt;
&lt;li&gt;Find-Transcript (This is a grep of the active transcript, but is not done yet)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
And I dropped this &amp;nbsp;in the end of my Profile, the &#39;go_locations&#39; are part of my quick jump list (see the full Profile at &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt; if you are interested).&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;Import-Module SushiHangover-Transcripts
Initialize-TranscriptLocation
$go_locations.Add(&quot;transcripts&quot;, $Global:SH:TranscriptDir)
$go_locations.Add(&quot;logs&quot;, $Global:SH:TranscriptDir)
Initialize-Transcript

&lt;/pre&gt;
&lt;br /&gt;
You will want the &quot;Initialize-Transcript&quot; at the end of your Profile otherwise you will be capturing everything your profile does... ;-)

As always get the latest version at my &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt;&amp;nbsp;as I will finish up the Find-Transcript along with my new version of &#39;Do-Grep&#39; next.&lt;br /&gt;
&lt;br /&gt;
Would love to hear how you are using transcripts in your work environment!&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/2119860865876938154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-console-logging-via.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2119860865876938154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2119860865876938154'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-console-logging-via.html' title='PowerShell : Console logging via Transcripts'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-584005341932455051</id><published>2012-10-24T21:21:00.000-07:00</published><updated>2012-10-24T21:21:00.323-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8"/><title type='text'>PowerShell : Windows License Status</title><content type='html'>
&#39;The Scripting Guy&#39; &lt;a href=&quot;http://blogs.technet.com/b/heyscriptingguy/archive/2010/03/11/hey-scripting-guy-march-11-2010.aspx&quot;&gt;posted&lt;/a&gt; a quick script that checks the license status of all the VMs running on a host. 
&lt;br/&gt;
&lt;br/&gt;
I added some error handling and a parameter to get the localhost license status...
&lt;br/&gt;&lt;br/&gt;
As always get the latest version at my &lt;a href=&quot;https://github.com/sushihangover&quot;&gt;GitHub&lt;/a&gt;.
&lt;br/&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;
&lt;#
    .NOTES
        Copyright 2013 Robert Nees
        Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
        http://sushihangover.blogspot.com
    .SYNOPSIS
        Get-WindowsLicensingStatus -- Check the License Status of Windows 8
    .DESCRIPTION
        The original script is from &#39;The Scripting Guys&#39; and I changed it to allow 
        local Windows 8 machines to be checked while still supporting VMs

        http://blogs.technet.com/b/heyscriptingguy/archive/2012/08/21/use-powershell-to-check-the-license-status-of-windows-8.aspx
    .EXAMPLE
        PS C:\&gt; Get-WindowsLicenseStatus.ps1 
        This example trys to the license status of all the VMs running on this host, if the VMMS service is not 
        running you wil get the license status of the localhost
    .EXAMPLE
        PS C:\&gt; Get-WindowsLicenseStatus.ps1 -LocalHost
        This example returns the license status of the localhost
    .LINK
        http://sushihangover.blogspot.com
#&gt;
Set-StrictMode –Version latest
Param (
    [Parameter(Mandatory=$false)][Switch]$LocalHost
)
Try {
    $vm = get-vm -ErrorAction SilentlyContinue
    if ($vm -ne $null) {
        $cim = New-CimSession -ComputerName $vm.name -ErrorAction SilentlyContinue
    }
} Catch [Microsoft.HyperV.PowerShell.Commands.GetVMCommand] {
    # The Virtual Machine Management Service is not running
    $cim = New-CimSession
} Catch {
    $cim = $null
} Finally {
    if ($cim -ne $null) {
        get-ciminstance -class SoftwareLicensingProduct -CimSession $cim |
          where {$_.name -match &#39;windows&#39; -AND $_.licensefamily} |
            format-list -property Name, Description, `
                     @{Label =&quot;Grace period (days)&quot;; Expression = { $_.graceperiodremaining / 1440}}, `
                     @{Label = &quot;License Status&quot;; Expression = {
                        switch (foreach {$_.LicenseStatus}) {
                            0 {&quot;Unlicensed&quot;} `
                            1 {&quot;Licensed&quot;} `
                            2 {&quot;Out-Of-Box Grace Period&quot;} `
                            3 {&quot;Out-Of-Tolerance Grace Period&quot;} `
                            4 {&quot;Non-Genuine Grace Period&quot;} `
                        } 
                      } }
    }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/584005341932455051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-windows-license-status.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/584005341932455051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/584005341932455051'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-windows-license-status.html' title='PowerShell : Windows License Status'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-8689023870077861579</id><published>2012-10-23T20:04:00.000-07:00</published><updated>2012-10-23T20:04:00.532-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="Text Encoding"/><title type='text'>PowerShell : File Encoding: Checking and Setting</title><content type='html'>I have had problems with editing/saving scripts in different editors across multiple OSs. You can end up with UTF8 files that will not work in a bash shell or .PS1 files in &#39;non-ASCII&#39; encoding that really freak out PowerShell at times with really bizarre errors.&lt;br /&gt;
&lt;br /&gt;
I never really investigated it beyond other than knowing that PowerShell 1.0 wants ASCII, PowerShell 2.0 does not care except when running on a XP client or some remote script execution will fail, etc... so I just accepted that anything but straight ASCII encoding can trip up PowerShell in different ways and Get-FileEncoding and Set-FileEncoding with fix that.&lt;br /&gt;
&lt;br /&gt;
I routinely use NSF/SMB shares to access and edit scripts (bash, sh, PowerShell, etc..) from Windows 8, OS-X and Linux and thus use these routines all the time to fix the file encodings...&lt;br /&gt;
&lt;br /&gt;
Get the &#39;current&#39; code at my &lt;a href=&quot;https://github.com/sushihangover&quot; target=&quot;_blank&quot;&gt;Git Hub Account&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;
function Get-FileEncoding
{
    &lt;#
    .NOTES
        Copyright 2012/2013 Robert Nees
        Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
        http://sushihangover.blogspot.com        
        ! Grap the original from http://poshcode.org/2059
    .SYNOPSIS
        Gets file encoding.
    .DESCRIPTION
        The Get-FileEncoding function determines encoding by looking at Byte Order Mark (BOM).
        Based on port of C# code from http://www.west-wind.com/Weblog/posts/197245.aspx
    .EXAMPLE
        Get-ChildItem  *.ps1 | select FullName, @{n=&#39;Encoding&#39;;e={Get-FileEncoding $_.FullName}} | where {$_.Encoding -ne &#39;ASCII&#39;}
        This command gets ps1 files in current directory where encoding is not ASCII
    .EXAMPLE
        Get-ChildItem  *.ps1 | select FullName, @{n=&#39;Encoding&#39;;e={Get-FileEncoding $_.FullName}} | where {$_.Encoding -ne &#39;ASCII&#39;} | foreach {(get-content $_.FullName) | set-content $_.FullName -Encoding ASCII}
        Same as previous example but fixes encoding using set-content
    #&gt;
    [CmdletBinding()] 
    Param (
        [Parameter(Mandatory=$True, ValueFromPipeline=$True)][string]$Path
    )
    Begin {
    }
    Process {
        [byte[]]$byte = get-content -Encoding byte -ReadCount 4 -TotalCount 4 -Path $Path
        if ($byte -ne $null) {
            if ($byte.Count -ge 4) {
                if ( $byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf ) {
                    Write-Output &#39;UTF8&#39; 
                } elseif ($byte[0] -eq 0xfe -and $byte[1] -eq 0xff) {
                    Write-Output &#39;Unicode&#39;
                } elseif ($byte[0] -eq 0 -and $byte[1] -eq 0 -and $byte[2] -eq 0xfe -and $byte[3] -eq 0xff) {
                    Write-Output &#39;UTF32&#39;
                } elseif ($byte[0] -eq 0x2b -and $byte[1] -eq 0x2f -and $byte[2] -eq 0x76) {
                    Write-Output &#39;UTF7&#39;
                } else {
                    Write-Output &#39;ASCII&#39;
                }
            } else {
                Write-Error -Message ($Path + &quot; is only &quot; + $byte.Count + &quot; bytes in size, unable to determine file encoding&quot;) -Category InvalidData
            }
        } else {
            Write-Error -Message ($Path + &quot; is zero byte(s) in size&quot;) -Category InvalidData
        }
    }
    End {
    }
}
Function Set-FileEncoding {
    &lt;#
    .NOTES
        Copyright 2012/2013 Robert Nees
        Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
        http://sushihangover.blogspot.com        
    .SYNOPSIS
        Sets/Changes file encoding.
    .DESCRIPTION
        The Set-FileEncoding function changes the file&#39;s encoding in place by using Set-Content 
        with the default encoding being &#39;Ascii&#39;
        EncodingTypes available are Unicode, Byte, BigEndianUnicode, UTF8, UTF7, Ascii
    .EXAMPLE
        Set-FileEncoding clear-trash.ps1 -whatif
        What if: Performing operation &quot;Set Content&quot; on Target &quot;Path: C:\Users\xavier\Documents\WindowsPowerShell\clear-trash.ps1&quot;.
    #&gt;
    [CmdletBinding()] 
    Param (
        [Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True)][string]$Path,
        [Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$EncodingType = &quot;Ascii&quot;,
        [Parameter(Mandatory=$False)][switch]$WhatIf
    )
    if ((Get-FileEncoding $Path) -ne $EncodingType) {
        # Need to &#39;buffer&#39; content as piping get and set will fail with file in use error...
        $FileContent = Get-Content $Path
        If ($WhatIf) {
            $FileContent | Set-Content $Path -WhatIf -Force -Encoding $EncodingType
        } else {
            $FileContent | Set-Content $Path -Force -Encoding $EncodingType
        }
    } else {
        If ($WhatIf) {
            &quot;File encoding is the same, no file change will occur&quot;
        }
    }
}
&lt;/pre&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/8689023870077861579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-file-encoding-checking-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8689023870077861579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8689023870077861579'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-file-encoding-checking-and.html' title='PowerShell : File Encoding: Checking and Setting'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-8511313999138789459</id><published>2012-10-21T16:33:00.000-07:00</published><updated>2012-10-21T16:33:00.676-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Memory"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell : Out of Memory in Remote Sessions (including 3.0)</title><content type='html'>Getting strange errors in running a script in a remote session that runs just fine locally? If you RDP&#39;d into that remote server and the script runs fine? Is the remote session error message have you befuddled?&lt;br /&gt;
&lt;br /&gt;
You might be running out of the heap space. PowerShell allocates 150MB by default to each new remote session in PowerShell 1.0/2.0 and 1024MB in PowerShell 3.0 and if that is exceeded, well you can get a wide range of Exceptions thrown:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;PSRemoting Transport Exception&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;OutOfMemory Exception&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;Could not reserve enough space for object heap&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica;&quot;&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;(Lots more....)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The increase of this default in PowerShell 3.0 might mask the problem for most users, but if your scripts are creating a lot of large objects (client side filtering is the easiest way to break even the 1024MB default or COM automation is another) than you might need to increase the &quot;&lt;span style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;&lt;b&gt;MaxMemoryPerShellMB&lt;/b&gt;&quot;&amp;nbsp;&lt;/span&gt;setting. Check that setting by using:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;get-item wsman:localhost\Shell\MaxMemoryPerShellMB&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Note: must be running as admin otherwise you will get an access error in retrieving or setting these Shell properties:&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Error number:&amp;nbsp; -2147024891 0x80070005&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Access is denied.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;You can than change it by using:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;set-item wsman:localhost\Shell\MaxMemoryPerShellMB 2048&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Of course winrm.exe can also be used in a cmd/batch file if this needs to be changed upon boot of new clients/servers.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;Remember that this memory increase can make a huge impact on a PWA server that is your gateway to OpsEng in your cloud/farm. If lots of people and schedulers are submitting scripts that are object pigs and they are eating &lt;b&gt;all&lt;/b&gt; your PWA server&#39;s memory than PowerShell performance can grind to a halt.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Now I review my code, re-work objects, ensure I am de-referencing objects and truly releasing COM objects. So my advice is to try to fit within the new 1GB default before changing a highly used PWA gateway.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;-Robert&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Helvetica; font-size: 12px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/8511313999138789459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-out-of-memory-in-remote.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8511313999138789459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8511313999138789459'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-out-of-memory-in-remote.html' title='PowerShell : Out of Memory in Remote Sessions (including 3.0)'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-619873249122613845</id><published>2012-10-15T19:35:00.000-07:00</published><updated>2012-10-15T19:35:00.525-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell : A &#39;true&#39; touch file routine</title><content type='html'>There are some (lots) of Linux style &#39;touch&#39; scripts in PowerShell, but for some reason they do not seem to follow a couple of basic *nix style conventions such as modify only the Access Time and/or Creation Time, or include &#39;-r&#39; (Replace time from a different file)&lt;br /&gt;
&lt;br /&gt;
So I whipped up a version of touch called Touch-File that supports the following *nix style options and is pipe enabled so you can pass it file path strings or fileinfo objects (ie: Get-ChildItem).&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;-a (AccessTime) Change just the access time of the file.&lt;/li&gt;
&lt;li&gt;-c &amp;nbsp;(Create) Do not create the file if it does not exist. &amp;nbsp;The touch utility&amp;nbsp;does not treat this as an error. &amp;nbsp;No error messages are displayed&amp;nbsp;and the exit value is not affected.&lt;/li&gt;
&lt;li&gt;-f &amp;nbsp; (Force) Attempt to force the update, even if the file permissions do not&amp;nbsp;currently permit it. &lt;b&gt;FYI: Only valid on file creation!&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;-m (ModificationTime) Change just the modification time of the file.&lt;/li&gt;
&lt;li&gt;-n (CreationTime) Change just the creation time of the file (when it was &#39;n&#39;ew).&lt;/li&gt;
&lt;li&gt;-r (Replace) Use the access and modifications times from the specified file&amp;nbsp;instead of the current time of day.&lt;/li&gt;
&lt;li&gt;-t (Time) Change the access and modification times to the specified time&amp;nbsp;instead of the current time of day. &amp;nbsp;The argument is of the form of a .Net DateTime string&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;#requires -version 2.0
&amp;lt;#
    .NOTES
        Copyright 2013 Robert Nees
        Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
        http://sushihangover.blogspot.com
    .SYNOPSIS
        touch-file -- change file access and modification times
    .DESCRIPTION
     The touch utility sets the modification and access times of files.  If any file does not exist, 
     it is created with default permissions. (see examples)
    .EXAMPLE
        TODO : Add Examples
    .LINK
        http://sushihangover.blogspot.com
#&amp;gt;
function Touch-File{
    [cmdletbinding(SupportsShouldProcess=$True)]
    Param(
        [Parameter(Mandatory=$true,ValueFromPipeline=$True)][String]$FileName,
        [Parameter(Mandatory=$false)][Alias(&#39;r&#39;)][String]$Replace = &quot;&quot;,
        [Parameter(Mandatory=$false)][Alias(&#39;t&#39;)][DateTime]$Time = $null,
        [Parameter(Mandatory=$false)][Alias(&#39;c&#39;)][Switch]$Create,
        [Parameter(Mandatory=$false)][Alias(&#39;a&#39;)][Switch]$AccessTime,
        [Parameter(Mandatory=$false)][Alias(&#39;m&#39;)][Switch]$ModificationTime,
        [Parameter(Mandatory=$false)][Alias(&#39;n&#39;)][Switch]$CreationTime,
        [Parameter(Mandatory=$false)][Alias(&#39;f&#39;)][Switch]$Force
    )
    begin {
        function Update-FileSystemInfo([System.IO.FileSystemInfo]$fsInfo) {
            if ($Time -ne $null) {
                $fsInfo.CreationTime = $CurrentDateTime
                $fsInfo.LastWriteTime = $CurrentDateTime
                $fsInfo.LastAccessTime = $CurrentDateTime
            } else {
                if ($AccessTime.IsPresent) {
                    $fsInfo.LastAccessTime = $CurrentDateTime
                }
                if ($ModificationTime.IsPresent) {
                    $fsInfo.LastWriteTime = $CurrentDateTime
                }
                if ($CreationTime.IsPresent) {
                    $fsInfo.CreationTime = $CurrentDateTime
                }
            }
        }
   
        function Touch-NewFile {
            [cmdletbinding(SupportsShouldProcess=$True)]
            Param(
                [Parameter(Mandatory=$True)][String]$FileName
            )
            if ($Force.IsPresent ) {
                Set-Content -Path ($FileName) -Value ($null) -Force
            } else {
                Set-Content -Path ($FileName) -Value ($null)
            }
            $fsInfo = new-object System.IO.FileInfo($FileName)
            return $fsInfo
        }
        if ($Replace -ne &quot;&quot;) {
            try {
                $replaceInfo = Get-ChildItem $Replace
                $CurrentDateTime = $replaceInfo.CreationTime
            } catch {
                return
            }
        } else {
            if ($Time -eq $null) {
                $CurrentDateTime = Get-Date            
            } else {
                $CurrentDateTime = $Time
            }
        }
    }
    process {
        if ($pscmdlet.ShouldProcess($FileName)) {
            if (test-path $FileName) {
                $fsInfo = Get-ChildItem $FileName
                Update-FileSystemInfo($fsInfo)
            }
            else {
                if (!$Create.IsPresent) {
                    $fsInfo = Touch-NewFile($FileName)
                    $fsInfo = Get-ChildItem $FileName
                    Update-FileSystemInfo($fsInfo)
                }
            }
        }
        $fsInfo = $null
    }
    end {
    }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/619873249122613845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-true-touch-file-routine.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/619873249122613845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/619873249122613845'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-true-touch-file-routine.html' title='PowerShell : A &#39;true&#39; touch file routine'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-8277473020338515069</id><published>2012-10-08T20:13:00.000-07:00</published><updated>2012-10-08T15:13:32.591-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Amazon"/><category scheme="http://www.blogger.com/atom/ns#" term="AWS"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="S3"/><title type='text'>PowerShell : AWS S3 Form Signing (Base64 and HMAC)</title><content type='html'>In my prior post about YouTube video uploading via PowerShell, I refer to a project that involves browser/html posting directly in an AWS S3 bucket.&lt;br /&gt;
&lt;br /&gt;
To prevent just anyone from posting files in someone&#39;s S3 bucket and using it as a &#39;free&#39; online storage container without the knowledge of the AWS account owner, the HTML form has two required hidden fields called &quot;policy&quot; and &quot;signature&quot;. These base64 strings contain restrictions/policies are HMAC SHA signed using the AWS account owner&#39;s secret key. The policy contain items such as which bucket the upload is allowed into, the allow file name filter and bucket key (i.e: folder name), what ACL will be assigned to new content, what mime types are allowed, the expiration date of this policy, and so on...&lt;br /&gt;
&lt;br /&gt;
So if you have not read &lt;a href=&quot;http://aws.amazon.com/articles/1434?_encoding=UTF8&quot; target=&quot;_blank&quot;&gt;Browser Uploads to S3 using HTML POST Forms&lt;/a&gt; on Amazon&#39;s site yet, please do so now so you will understand the steps needed and how to write the policy file that needs to be signed and how the HTML form members need to match what is in the policy file. This script deals only with the HMAC signing portion.&lt;br /&gt;
&lt;br /&gt;
Below is a policy example that only allows 5MB files to be posted as non-public files into a &#39;sushihangover&#39; bucket and stored under the &#39;shareyourvideos&#39; key (...think of keys as directories...), successful postings will cause the browser to be redirected my blog and this policy expires at the beginning of&amp;nbsp; April. There is more you can do in a policy, but these are the core items that you need:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;{&quot;expiration&quot;: &quot;2012-04-01T00:00:00Z&quot;,
&amp;nbsp; &quot;conditions&quot;: [
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&quot;bucket&quot;: &quot;sushihangover&quot;},
&amp;nbsp;&amp;nbsp;&amp;nbsp; [&quot;starts-with&quot;, &quot;$key&quot;, &quot;shareyourvideos/&quot;],
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&quot;acl&quot;: &quot;private&quot;},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&quot;success_action_redirect&quot;: &quot;http://sushihangover.blogspot.com/&quot;},
&amp;nbsp;&amp;nbsp;&amp;nbsp; [&quot;starts-with&quot;, &quot;$Content-Type&quot;, &quot;&quot;],
&amp;nbsp;&amp;nbsp;&amp;nbsp; [&quot;content-length-range&quot;, 0, 5242880]
&amp;nbsp; ]
}
&lt;/pre&gt;
&lt;br /&gt;
These policy items will get signed and placed into your HTML form as hidden fields along with your public AWS key, the base64 version of your policy file, and the &lt;a href=&quot;http://en.wikipedia.org/wiki/HMAC&quot; target=&quot;_blank&quot;&gt;hashed&amp;nbsp; message code&lt;/a&gt; of that policy file and your AWS secret key. That way only your public key is stored in the form posting and your secret key remains a secret to just you and Amazon.&lt;br /&gt;
&lt;br /&gt;
.Net makes dealing with UTF8, Base64 encoding and making HMAC digests really easy. The script (below or grab the latest version from &lt;a href=&quot;https://github.com/sushihangover/PowerShell-Scripts%20&quot; target=&quot;_blank&quot;&gt;my GIT repository&lt;/a&gt;) works in one or two passes. In the setup mode, you can pass in your AWS secret key and it will be save in a CLIXML for future signing. The signing mode, you pass your AWS secret key each time if you do not wish to save it with the &#39;setup mode&#39;, along with the file name of your policy and you get an object back that has two properties; policy and signature. You can pipe this object to another script/function that inserts the values into your form auto-magically or just pipe it to &quot;Format-List&quot; and you can cut/paste them into your HTML form.&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;» Do-AWSSignS3PostingForm.ps1 -form .\UploadPolicyDocument | format-list

policy    : eyJleHBXXXXXX_THIS_IS_XXXXXXXXY29uZGl0aW9ucyI6IFsgI
            CAgIXXXXXXXXXXXX_NOT_A_REAL_XXXXgWyJzdGFydHMtd2l0aC
            IsICIka2V5IiwgXXXXXXX_BASE64_OUTPUT_XXAgICB7InN1Y2N
            lc3NfYWN0aW9XXXXXXXXXXXXXXXXXXXXXE3LmNvbXB1dGUtMS5h
            bWF6XXXXXXXXXXXXXXXXXXXWRzdWNjZXNzZnVsLmh0bWwifSwgI
            CAgIFsiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZW
            5ndGgtcmFXXXXXXXXXXXXXXXXXXXXXXXXgfQ==
signature : QBfXXXXXXXXXXXXXXXXXXXXXXXXA=
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;
Note: The CLIXML file is NOT encrypted and your AWS secret key is stored in the clear within your $HOME directory. My home directory is encrypted by default and this version of the script does not use &quot;SecureString&quot; which could be tied to machine key authentication, AD GPO based, or... Ask and I&#39;ll show you how to do this without storing the ConvertTo-SecureString and ConvertFrom-SecureString &#39;passcode&#39; in the clear within a script.&lt;br /&gt;
&lt;br /&gt;
Also check out &lt;a href=&quot;http://zefer.posterous.com/pure-html-ajax-solutions-to-upload-files-to-s&quot;&gt;HTML &amp;amp; AJAX solutions to upload files to S3&lt;/a&gt; to see how to setup a proxy to do cross-domain AJAX posting to S3, worked out great me and I ended up with HTML, HTML5, AJAX and Flash posting into S3 in order to cover all the browser types/versions that are in the wild....
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;&amp;lt;#
.NOTES
Copyright 2012 Robert Nees
Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
http://sushihangover.blogspot.com
.SYNOPSIS
Sign a HTML post form to allow direct uploading to a S3 bucket
.DESCRIPTION
Posting directly to a S3 bucket can save a lot of I/O on your EC2 instance that
would need to move it to an S3 after the upload is complete. That process just
does not scale well, but direct S3 posting via HTML, HTML5, or Ajax is the to 
ensure that your upload application scales in a linear fashion across AWS.

* Check out the following posts:

Browser Uploads to S3 using HTML POST Forms : http://aws.amazon.com/articles/1434?_encoding=UTF8
HTML &amp;amp; AJAX solutions to upload files to S3 : http://zefer.posterous.com/pure-html-ajax-solutions-to-upload-files-to-s
.EXAMPLE
[107] » Do-AWSSignS3PostingForm.ps1 -form .\UploadPolicyDocument | format-list

policy    : eyJleHBXXXXXXXXXXXXXXXXXXXXXXXY29uZGl0aW9ucyI6IFsgI
            CAgIXXXXXXXXXXXXXXXXXXXXXXXXXXXXgWyJzdGFydHMtd2l0aC
            IsICIka2V5IiwgXXXXXXXXXXXXXXXXXXXXXXXXAgICB7InN1Y2N
            lc3NfYWN0aW9XXXXXXXXXXXXXXXXXXXXXE3LmNvbXB1dGUtMS5h
            bWF6XXXXXXXXXXXXXXXXXXXWRzdWNjZXNzZnVsLmh0bWwifSwgI
            CAgIFsiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZW
            5ndGgtcmFXXXXXXXXXXXXXXXXXXXXXXXXgfQ==
signature : QBfXXXXXXXXXXXXXXXXXXXXXXXXA=
.LINK
http://sushihangover.blogspot.com
http://aws.amazon.com/articles/1434?_encoding=UTF8
http://zefer.posterous.com/pure-html-ajax-solutions-to-upload-files-to-s
#&amp;gt;
[CmdletBinding()]
Param(
    [Parameter(parametersetname=&quot;Main&quot;,Mandatory=$true)][Alias(&#39;form&#39;)][string]$formFields,
    [Parameter(parametersetname=&quot;Main&quot;,Mandatory=$false)][Alias(&#39;secert&#39;)][string]$secertKey = &#39;&#39;,
    [Parameter(parametersetname=&quot;Main&quot;,Mandatory=$false)][switch]$whatif,
    [Parameter(parametersetname=&quot;Setup&quot;,Mandatory=$true)][Alias(&#39;savekey&#39;)][string]$saveSecertKey
        )
Begin {
    switch ($PsCmdlet.ParameterSetName)
    {
        &quot;Setup&quot;  {
            $file = $MyInvocation.MyCommand.Name
            $google = New-Object PSOBject
            $google | add-member -membertype noteproperty -name secretkey -value $saveSecertKey
            $google | export-clixml -Path $HOME\aws_secretkey.xml
            exit
        }
        &quot;Main&quot;  {
            if ($secertKey -eq &#39;&#39;) {
                if (!(Test-Path $HOME\aws_secretkey.xml)) {
                    write-host &#39;SecertKey not provide via parameter and Secret Key file missing&#39; -ForegroundColor Red
                    help ($MyInvocation.MyCommand.Name) -examples
                    exit
                }
                $s3 = Import-Clixml $HOME\aws_secretkey.xml
            } else {
                $s3 = New-Object PSOBject
                $s3 | add-member -membertype noteproperty -name secretkey -value $secretKey
            }
            $awsS3 = New-Object PSOBject
            $awsS3 | add-member -membertype noteproperty -name policy -value &#39;&#39;
            $awsS3 | add-member -membertype noteproperty -name signature -value &#39;&#39;
        }
    }
}
Process {
    $utf8 = New-Object System.Text.utf8encoding
    $hmacsha = New-Object System.Security.Cryptography.HMACSHA1

    $formContents = Get-Content -Encoding Ascii $formFields
    $awsS3.policy = [System.Convert]::ToBase64String(
        $utf8.Getbytes($formContents)
    )

    $hmacsha.key = $utf8.Getbytes($s3.secretkey)
    $awsS3.signature = [System.Convert]::Tobase64String(
        $hmacsha.ComputeHash(
            $utf8.GetBytes($awsS3.policy)
        )
    )
    return $awsS3
}
End {
    $google = $null
    $awsS3 = $null
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;/li&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/8277473020338515069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/03/powershell-aws-s3-form-signing-base64.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8277473020338515069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8277473020338515069'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/03/powershell-aws-s3-form-signing-base64.html' title='PowerShell : AWS S3 Form Signing (Base64 and HMAC)'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-4998747255626168768</id><published>2012-10-03T19:30:00.000-07:00</published><updated>2012-10-05T13:43:36.999-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="3.0"/><category scheme="http://www.blogger.com/atom/ns#" term="Hyper-V"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell: Converting a VHD to a VHDX</title><content type='html'>Just a quickie. Weird how timing works, needed to script the conversion of &#39;large dir&#39; of VHDs to VHDX to run some tests under Server 2012 and &amp;nbsp;MSDN &#39;Virtual PC Blog Guy&#39; just posted about that:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/10/03/using-powershell-to-convert-a-vhd-to-a-vhdx.aspx&quot;&gt;Using PowerShell to Convert a VHD to a VHDX&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Totally easy to use &quot;get-childitem&quot; and piping this to &quot;foreach-object&quot;... I was done in a couple of minutes ;-) and do not have to sit in the Hyper-V Manager clicking through dozens of files. Now I can forget about it &amp;nbsp;and the VHDXs will be ready in tomorrow.&lt;br /&gt;
&lt;br /&gt;
IMHO; if you do not have the PC Blog Guy&#39;s feeds on your RSS reader you are missing some good stuff...</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/4998747255626168768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-converting-vhd-to-vhdx.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/4998747255626168768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/4998747255626168768'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/10/powershell-converting-vhd-to-vhdx.html' title='PowerShell: Converting a VHD to a VHDX'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-8718055545993149892</id><published>2012-10-01T19:00:00.000-07:00</published><updated>2012-10-02T14:22:03.084-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Amazon"/><category scheme="http://www.blogger.com/atom/ns#" term="AWS"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="S3"/><title type='text'>PowerShell : Bulk uploading to a S3 bucket</title><content type='html'>You have your AWS Credentials saved per the last post using &quot;&lt;b&gt;Set-AWSCredentials&lt;/b&gt;&quot; and can do a &quot;&lt;b&gt;Read-S3Buckets&lt;/b&gt;&quot; and get back an object listing of your S3 buckets in order to test that your &lt;i&gt;access &lt;/i&gt;and &lt;i&gt;private &lt;/i&gt;keys have been entered/saved correctly.&lt;br /&gt;
&lt;br /&gt;
Now you need to upload some content into a S3 bucket. That is super easy using the command that I wrote called &quot;&lt;b&gt;Publish-S3&lt;/b&gt;&quot; and as long as you can &quot;&lt;b&gt;ls&lt;/b&gt;&quot; (alias for Get-ChildItem) the local file(s) that you need uploaded, you can publish files to S3.&lt;br /&gt;
&lt;br /&gt;
Let try it:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;CD into the directory that the file(s) exist that you need upload&lt;/li&gt;
&lt;li&gt;Do an &lt;b&gt;&quot;ls&lt;/b&gt;&quot; with any type of options needed to get a listing of just the files you need upload&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;Use any &lt;b&gt;Get-Children&lt;/b&gt; options that you would need, i.e: -filter, -include, -recurse, ....&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Pipe the results of &quot;&lt;b&gt;ls&lt;/b&gt;&quot; to Publish-S3 and include the name of the bucket to upload into...&lt;/li&gt;
&lt;/ul&gt;
Putting that all together and let use the &quot;-&lt;b&gt;whatif&lt;/b&gt;&quot; switch parameter to get a listing of what files would have been upload:&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;ls * -filter foobar | Publish-S3 -recurse -bucket sushihangover2 -whatif
&lt;/pre&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJtD54s3WYqj2jR2gvcSkE0GEcnkVL3KwO7J2N_cz3wTKKvti1KyFWT7T3NnUbwjmP-ORfqJZreOUcGrWjgAEdL56Fn7TsAcv4zUClmpi-AtPS8PdQaQObbSGk__gTx7xn6kPZDEKz0QA/s1600/Capture.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJtD54s3WYqj2jR2gvcSkE0GEcnkVL3KwO7J2N_cz3wTKKvti1KyFWT7T3NnUbwjmP-ORfqJZreOUcGrWjgAEdL56Fn7TsAcv4zUClmpi-AtPS8PdQaQObbSGk__gTx7xn6kPZDEKz0QA/s1600/Capture.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Ahhh...there is an error output in red that says the bucket does not exist. So check the name of the bucket that you are used in the command and ensure that you spelled it correctly. You did? OK, so that means you need to create the bucket before you can upload into it. This can be thought of as creating a root directory on a drive before you copy any files into it.&lt;br /&gt;
&lt;br /&gt;
Two ways you can you create a new bucket; The first way is to use &quot;&lt;b&gt;New-Bucket&lt;/b&gt;&quot; command and the second way is to use the &quot;&lt;b&gt;-force&lt;/b&gt;&#39; switch parameter on &quot;&lt;b&gt;Publish-S3&lt;/b&gt;&quot;. So lets try adding &quot;-force&quot; and keep &quot;-whatif&quot; to see what would happen&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;ls * -filter foobar | Publish-S3 -recurse -bucket sushihangover2 -force -whatif&lt;/pre&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0hAr_pvMNTzL1O4kBul-ou0imm8cDpZuoxYuG-lmkdRdGNjIfh6ar0-fEm13VQT837ds5I2Dh7OcIHi2wD2CtQb4bBNtMzd4kme9vdb7L6FWWphVLhMwzS0nV2JsnefO5KCPcBtQGN0/s1600/Capture.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0hAr_pvMNTzL1O4kBul-ou0imm8cDpZuoxYuG-lmkdRdGNjIfh6ar0-fEm13VQT837ds5I2Dh7OcIHi2wD2CtQb4bBNtMzd4kme9vdb7L6FWWphVLhMwzS0nV2JsnefO5KCPcBtQGN0/s1600/Capture.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
You still get the red error message that the bucket does not exist, but you also get a green message stating that the bucket will be created.&lt;br /&gt;
&lt;br /&gt;
The &#39;file&#39; listing that you get back from running Publish-S3 is actually an array of custom PSObjects that contain the bucket, the AWS S3 key name and the local full path and file name of the file that would have be uploaded. You can place this whatif output into the down stream pipeline if you need to verify the file listing with your publication requirements.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;ls * -filter foobar | publish-S3 -recurse -bucket sushihangover2 -whatif -force | ft -GroupBy bucket -Property key, local -auto
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiePugZSZuM-eF-kZ1A1NDySIobX23HWZonoYHhCU6pR56XN9zsZM3v2TwI6F-xC-BMpL06ZbmVCaqe0HO1n1FuQIoVWZBEdjEhmCSNxzOQ_zXFEpNduYYKHrpKOsFiFa7JQVNGmlYW5h4/s1600/Capture.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiePugZSZuM-eF-kZ1A1NDySIobX23HWZonoYHhCU6pR56XN9zsZM3v2TwI6F-xC-BMpL06ZbmVCaqe0HO1n1FuQIoVWZBEdjEhmCSNxzOQ_zXFEpNduYYKHrpKOsFiFa7JQVNGmlYW5h4/s1600/Capture.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
But instead of just piping it to &quot;Format-Table&quot;, you could have piped it to a CSV file, or a Excel WorkSheet importer, posted it to a workflow in SharePoint for approved, etc... &lt;br /&gt;
&lt;br /&gt;
OK, enough of the &quot;-&lt;b&gt;whatif&lt;/b&gt;&quot; testing, lets create the new bucket and upload the files:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;ls * -filter foobar | publish-S3 -recurse -bucket sushihangover2 -force
&lt;/pre&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7JKn3r4MfRA6R-j8Yfs2sWNOdU6Xb7-rEUqegE-Sk1zyS07KEDbdQ_nC0hsY3ZMTmPm_QvbUFLsBtq_WqJop43TgxWekGm6wS2vK1W6SfijJ5RhXdA11btTs5Kp41rHO7_jIHkDnWC5g/s1600/Capture.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7JKn3r4MfRA6R-j8Yfs2sWNOdU6Xb7-rEUqegE-Sk1zyS07KEDbdQ_nC0hsY3ZMTmPm_QvbUFLsBtq_WqJop43TgxWekGm6wS2vK1W6SfijJ5RhXdA11btTs5Kp41rHO7_jIHkDnWC5g/s1600/Capture.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The result of the &quot;&lt;b&gt;Publish-S3&lt;/b&gt;&quot; is a &lt;b&gt;&quot;$AWSS3UploadQueue&lt;/b&gt;&quot; object array of Amazon transfer jobs, Amazon has an a-sync transfer routine that will chuck large files into smaller ones and it rebuilds once on S3 and works really well, and if you wish to read more about it, visit the &lt;a href=&quot;http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/Index.html&quot; target=&quot;_blank&quot;&gt;SDK documentation&lt;/a&gt; and read about the transfer utility within the &lt;span id=&quot;nsrTitle&quot;&gt;&lt;a href=&quot;http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/html/N_Amazon_S3_Transfer.htm&quot; target=&quot;_blank&quot;&gt;Amazon.S3.Transfer Namespace&lt;/a&gt; section.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span id=&quot;nsrTitle&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span id=&quot;nsrTitle&quot;&gt;For now, just know that your files are being uploaded in the background of this PowerShell session and that you can do:&lt;/span&gt;&lt;br /&gt;
&lt;span id=&quot;nsrTitle&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span id=&quot;nsrTitle&quot;&gt;
&lt;/span&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;&lt;span id=&quot;nsrTitle&quot;&gt;$AWSS3UploadQueue
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span id=&quot;nsrTitle&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3VcfIdT8bBiwy_gV7BwN1llyeeJqByj_ouaSzx3Omgopg2hZcLOYpQFxaYzvq0GTwn_Qre5QHGPyE9rQLOTJGnSUNxsmNA7Oy7QJPDq6-VDFX55zys2C8FIOKNxlZ7RxGMD37r-YjzEU/s1600/Capture.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3VcfIdT8bBiwy_gV7BwN1llyeeJqByj_ouaSzx3Omgopg2hZcLOYpQFxaYzvq0GTwn_Qre5QHGPyE9rQLOTJGnSUNxsmNA7Oy7QJPDq6-VDFX55zys2C8FIOKNxlZ7RxGMD37r-YjzEU/s1600/Capture.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;nsrTitle&quot;&gt;&lt;br /&gt;&lt;/span&gt;
The &#39;&lt;b&gt;IsCompleted&lt;/b&gt;&#39; property will show you if that file is done uploading or not. Later we will go into adding visual Progress bars, making it &#39;synchronize&#39; if you workflow requires that, adding callback events, doing it &quot;AsJob&quot;, etc... but for now, get to work and fill those S3 Buckets up....&lt;br /&gt;
&lt;br /&gt;
Note: Do no close this PowerShell session down as that would kill the Amazon transfer routine.&lt;br /&gt;
&lt;br /&gt;
Note: None of this is going to work unless you get my SushiHangover AWS Script from my GIT repository at https://github.com/sushihangover/PowerShell-Script&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/8718055545993149892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/03/powershell-bulk-uploading-to-new-s3.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8718055545993149892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/8718055545993149892'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/03/powershell-bulk-uploading-to-new-s3.html' title='PowerShell : Bulk uploading to a S3 bucket'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJtD54s3WYqj2jR2gvcSkE0GEcnkVL3KwO7J2N_cz3wTKKvti1KyFWT7T3NnUbwjmP-ORfqJZreOUcGrWjgAEdL56Fn7TsAcv4zUClmpi-AtPS8PdQaQObbSGk__gTx7xn6kPZDEKz0QA/s72-c/Capture.JPG" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1823176357928063709.post-2979304231213126098</id><published>2012-09-16T17:29:00.000-07:00</published><updated>2013-01-08T19:46:23.823-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Amazon"/><category scheme="http://www.blogger.com/atom/ns#" term="AWS"/><category scheme="http://www.blogger.com/atom/ns#" term="EC2"/><category scheme="http://www.blogger.com/atom/ns#" term="Powershell"/><title type='text'>PowerShell: RSA Private Key based Encrypt and Decrypt</title><content type='html'>&amp;nbsp;&lt;a href=&quot;http://sushihangover.blogspot.com/2013/01/powershell-rsa-private-key-based.html&quot;&gt;Updated post and code in a new post, click me...&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I have done a number of&amp;nbsp; encryption/decryption routines in my past coding experiences, and normally like to take advantage of proven techniques and so does Amazon ;-)&lt;br /&gt;
&lt;br /&gt;
Amazon publishes the Window Administrator&#39;s password that are randomly generated upon AMI to Instance creation in Base64 format that have been encrypted using the SSL private key that was associated to the instance upon creation. The AWS web console interface provides an interactive way to retrieve and decrypt this password using your local private key file using RSA PKCS#1 v1.5 padded format, but GUI&#39;s are for wimps, so I wanted to use the AWS SDK to retrieve and decrypt the password.&lt;br /&gt;
&lt;br /&gt;
Check out the &#39;Get-EC2Password&#39; cmdlet in the &#39;Sushi-AWSEC2&#39; module to see this routine in action with AWS EC2 Windows based Instances, but you can also use this module stand alone to build your own private encyption and decryption routines.&lt;br /&gt;
&lt;br /&gt;
An simple start to finish example using these functions would go like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;. Do-RSACrypto
$PemFile = $HOME + &#39;\.ssh\sushibob.pem&#39;
. Set-RSACryptoServiceProvider $PemFile
$preClearText = &quot;Hello, Lets keep this a secret&quot;
$preclearText
$clearBytes =&amp;nbsp; Do-StringToByte $clearText
$clearBase64 = Do-ToBase64 $clearBytes
$cypherBytes = Do-RSAEncrypt $clearBase64 $false
$cypherBase64&amp;nbsp; = Do-ToBase64 $cypherBytes
$cypherBase64
$clearBytes = Do-RSADecrypt $cypherBase64 $false
$postclearText =&amp;nbsp; Do-ByteToString $clearBytes
$postclearText
Compare-Object $preclearText $postclearText -CaseSensitive -Includeequal
&lt;/pre&gt;
&lt;br /&gt;
As always you should grab the latest version of this from my PowerShell GIT repository at https://github.com/sushihangover/SushiHangover-AWS</content><link rel='replies' type='application/atom+xml' href='http://sushihangover.blogspot.com/feeds/2979304231213126098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sushihangover.blogspot.com/2012/04/powershell-rsa-private-key-based.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2979304231213126098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1823176357928063709/posts/default/2979304231213126098'/><link rel='alternate' type='text/html' href='http://sushihangover.blogspot.com/2012/04/powershell-rsa-private-key-based.html' title='PowerShell: RSA Private Key based Encrypt and Decrypt'/><author><name>Robert N.</name><uri>http://www.blogger.com/profile/11203454907383492138</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgef8ODXLe4c659xoHUQ3JZ1YERFykRUsZvHwukc-NShDNBnte7_ah9hp35OOaO4tASH9K7mVH8bM6nRWM-PJ62Pr2-TGKJ7xy1CFpSfsUqM53SGlY5KOrkiesYwrxs8w/s220/madmen_icon.jpg'/></author><thr:total>2</thr:total></entry></feed>