<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>PowerShell on James Montgomery</title>
    <link>https://gh-jamesmontgomery.github.io/pages-blog/tags/powershell/</link>
    <description>Recent content in PowerShell on James Montgomery</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <lastBuildDate>Thu, 05 Dec 2019 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://gh-jamesmontgomery.github.io/pages-blog/tags/powershell/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Detecting digit combinations in a number with PowerShell</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/12/detecting-digit-combinations-in-a-number-with-powershell/</link>
      <pubDate>Thu, 05 Dec 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/12/detecting-digit-combinations-in-a-number-with-powershell/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;How do you pass the time on a car journey? Most of us have memories of &amp;ldquo;I spy&amp;rdquo; or other game.&lt;/p&gt;&#xA;&lt;p&gt;Lately, I&amp;rsquo;ve been looking out for number combinations after a car I owned passed 123k miles - specifically 123456 miles. What&amp;rsquo;s more, the trip computer almost made it read 1234567890!&lt;/p&gt;&#xA;&lt;p&gt;As time passed, I was looking out for other odometer readings. 123465 miles was the next number of interest. The trip computer, however, didn&amp;rsquo;t complete the set.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Detecting Digits with PowerShell</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/10/detecting-digits-with-powershell/</link>
      <pubDate>Mon, 28 Oct 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/10/detecting-digits-with-powershell/</guid>
      <description>&lt;h1 id=&#34;table-of-contents&#34;&gt;Table of contents&lt;/h1&gt;&#xA;&lt;div class=&#34;toc&#34;&gt;&#xA;    &lt;nav id=&#34;TableOfContents&#34;&gt;&#xA;  &lt;ul&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#tl-dr&#34;&gt;TL; DR&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#how-to-think-about-the-problem&#34;&gt;How to think about the problem&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#working-with-a-number-in-powershell&#34;&gt;Working with a number in PowerShell&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#systemmathdivrem&#34;&gt;[System.Math]::DivRem&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-divrem-to-detect-a-digit&#34;&gt;Using DivRem to detect a digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-divrem-to-detect-a-range-of-digits&#34;&gt;Using DivRem to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#contains&#34;&gt;Contains&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-contains-to-detect-a-digit&#34;&gt;Using .contains() to detect a digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-contains-to-detect-a-range-of-digits&#34;&gt;Using .contains() to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#match&#34;&gt;Match&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--match-to-detect-a-specific-digit&#34;&gt;Using -match to detect a specific digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--match-to-detect-a-range-of-digits&#34;&gt;Using -Match to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#split&#34;&gt;Split&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--split-to-detect-a-digit&#34;&gt;Using -split to detect a digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--split-to-detect-a-range-of-digits&#34;&gt;Using -split to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#ascii-method&#34;&gt;ASCII Method&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-the-ascii-value-of-a-character-to-detect-unique-digits-in-a-number&#34;&gt;Using the ASCII value of a character to detect unique digits in a number&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#conclusion&#34;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#acknowledgements&#34;&gt;Acknowledgements&lt;/a&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/nav&gt;&#xA;  &lt;/div&gt;  &#xA;&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;Have you ever wondered, how many unique digits are in a number? Alternatively, how many times does a given digit appear in a number? Using PowerShell, I explore these questions in a variety of means and examples.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Producing live visuals from a PowerShell REST API</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/05/producing-live-visuals-from-a-powershell-rest-api/</link>
      <pubDate>Fri, 17 May 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/05/producing-live-visuals-from-a-powershell-rest-api/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;In this post, I&amp;rsquo;d like to share an example of bringing to life the data returned by an API. One PowerShell example takes the output of &lt;code&gt;Get-NetTCPConnection&lt;/code&gt; and &lt;code&gt;Get-Process&lt;/code&gt; to create a JSON representation of process IDs and their network connections.&lt;/p&gt;&#xA;&lt;p&gt;Universal Dashboard provides the means to expose this via REST API. Lastly, the &lt;code&gt;vis.js&lt;/code&gt; network module creates a visual representation of this data.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;    &#xA;&#xA;    &#xA;    &#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;    &#xA;  &#xA;&#xA;&#xA;    &#xA;&#xA;    &lt;div class=&#34;box alt&#34;&gt;&#xA;        &lt;div class=&#34;row uniform&#34;&gt;&#xA;        &#xA;        &#xA;        &#xA;            &#xA;                &lt;div class=&#34;1u&#34;&gt;&#xA;            &#xA;            &#xA;        &#xA;            &#xA;                &#xA;                    &#xA;                    &lt;span class=&#34;image fit&#34;&gt;&#xA;                &#xA;            &#xA;            &#xA;        &#xA;            &#xA;                &#xA;                        &lt;img src=&#39;https://gh-jamesmontgomery.github.io/pages-blog/img/2019/05/visjs-overview.png&#39;&#xA;                            alt=&#34;IPv4 and IPv6 connections to a remote address on port 443 graphed&#34;&gt;&#xA;                    &lt;/span&gt;&lt;/div&gt;&#xA;                &#xA;                &#xA;            &#xA;            &#xA;        &#xA;        &lt;/div&gt;&#xA;    &lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Here is an example video:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Visualising your DNS cache with PSGraph</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/04/visualising-your-dns-cache-with-psgraph/</link>
      <pubDate>Fri, 26 Apr 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/04/visualising-your-dns-cache-with-psgraph/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;In this post, I&amp;rsquo;d like to introduce you to how I&amp;rsquo;ve used &lt;a href=&#34;https://github.com/KevinMarquette/PSGraph/&#34;&gt;PSGraph&lt;/a&gt; to create visuals from code.  I&amp;rsquo;ll show you how to represent the Windows DNS cache graphically. Here is an example output (&lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/img/2019/04/psgraph-cache-1.png&#34;&gt;click for a full size image&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/img/2019/04/psgraph-cache-1.png&#34;&gt;&#xA;&#xA;&#xA;    &#xA;&#xA;    &#xA;    &#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;    &#xA;  &#xA;&#xA;&#xA;    &#xA;&#xA;    &lt;div class=&#34;box alt&#34;&gt;&#xA;        &lt;div class=&#34;row uniform&#34;&gt;&#xA;        &#xA;        &#xA;        &#xA;            &#xA;                &lt;div class=&#34;1u&#34;&gt;&#xA;            &#xA;            &#xA;        &#xA;            &#xA;                &#xA;                    &#xA;                    &lt;span class=&#34;image fit&#34;&gt;&#xA;                &#xA;            &#xA;            &#xA;        &#xA;            &#xA;                &#xA;                        &lt;img src=&#39;https://gh-jamesmontgomery.github.io/pages-blog/img/2019/04/psgraph-cache-1.png&#39;&#xA;                            alt=&#34;Sample of my cache&#34;&gt;&#xA;                    &lt;/span&gt;&lt;/div&gt;&#xA;                &#xA;                &#xA;            &#xA;            &#xA;        &#xA;        &lt;/div&gt;&#xA;    &lt;/div&gt;&#xA;&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Below I cover how to arrive at that outcome. You can find all scripts used at my &lt;a href=&#34;https://github.com/gh-jamesmontgomery/psgraph-dns-cache&#34;&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;why-dns&#34;&gt;Why DNS&lt;/h2&gt;&#xA;&lt;p&gt;The hierarchical nature of DNS (subdomain.topleveldomain.rootdomain) lends itself to graphing. Head over to &lt;a href=&#34;https://dnsdumpster.com/&#34;&gt;dnsdumpster&lt;/a&gt; if you want to see an excellent example of that.&lt;/p&gt;</description>
    </item>
    <item>
      <title>A punnet of raspberries with a side of visuals</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/04/a-punnet-of-raspberries-with-a-side-of-visuals/</link>
      <pubDate>Sat, 06 Apr 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/04/a-punnet-of-raspberries-with-a-side-of-visuals/</guid>
      <description>&lt;h1 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h1&gt;&#xA;&lt;p&gt;I finally dusted off that Raspberry Pi in the corner. Initially, I was putting Pi-hole through its paces. One thing led to another as a new rabbit hole emerged in the form of adding encrypted transport to forwarded queries (a &lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/2019/03/a-punnet-of-raspberries-with-a-side-of-api/#relevant-posts&#34;&gt;subject&lt;/a&gt; I visited in the past). I purchased another Pi for resiliency. I then explored how I might visualise the performance of the solution.&lt;/p&gt;&#xA;&lt;p&gt;Lastly, a first for me, I have shared this code on my &lt;a href=&#34;https://github.com/gh-jamesmontgomery/ud-ping-dns&#34;&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>TTS project update 1 - adding texture to my generated speech</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/03/tts-project-update-1-adding-texture-to-my-generated-speech/</link>
      <pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/03/tts-project-update-1-adding-texture-to-my-generated-speech/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;In this post, I&amp;rsquo;d like to share an update on work to address some of the limitations in my &lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/projects/google-cloud-text-to-speech#limitations&#34;&gt;text to speech project for Elite Dangerous.&lt;/a&gt;. Namely:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Single voice is used for the synthesis; and&lt;/li&gt;&#xA;&lt;li&gt;Pitch, tone and emphasis are unchanged from defaults.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you&amp;rsquo;d like to see the result of the work so far, here is a brief overview video, I&amp;rsquo;ll describe how we got here below:&lt;/p&gt;&#xA;&lt;!-- markdownlint-disable MD033 --&gt;&#xA;&lt;div align=&#34;center&#34;&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=6wFioalyoek&#34;&gt;&lt;img src=&#34;https://img.youtube.com/vi/6wFioalyoek/0.jpg&#34; alt=&#34;TTS March 19 update video!&#34;&gt;&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Google Cloud Text-to-Speech with PowerShell</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/02/google-cloud-text-to-speech-with-powershell/</link>
      <pubDate>Sun, 10 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/02/google-cloud-text-to-speech-with-powershell/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;In this post, I&amp;rsquo;ll walk through the basics of using PowerShell to interact with the Google Cloud Text-to-Speech API. Partly a documentation exercise and somewhat a guide I&amp;rsquo;d like to have been able to read when I started on my &lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/projects/elite-dangerous-text-to-speech/&#34;&gt;Elite Dangerous Google Cloud Text-to-Speech project&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As such, we&amp;rsquo;ll start with a basic script to produce an audio file and explain how that works. Later I&amp;rsquo;ll walk through some parameters of interest to affect the response. Lastly, I&amp;rsquo;ll introduce how we can use SSML for a variation in response.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to base64 decode on Windows 10 without base64.exe</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/01/how-to-base64-decode-on-windows-10-without-base64.exe/</link>
      <pubDate>Thu, 10 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/01/how-to-base64-decode-on-windows-10-without-base64.exe/</guid>
      <description>&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;&#xA;&lt;p&gt;You can call certutil from PowerShell to produce the required file.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;There is a moment in life where you get stuck in a quick start guide - we&amp;rsquo;ve all been there. At the start of my &lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/projects/elite-dangerous-text-to-speech/&#34;&gt;Google Cloud text-to-speech project&lt;/a&gt; it arrived quickly and unexpectedly at &lt;a href=&#34;https://cloud.google.com/text-to-speech/docs/base64-decoding&#34;&gt;step two of this two-step quick start guide&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I had successfully returned my first base64 encoded speech audio, onward to the last step:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;ldquo;Decode the source text file using the Base64.exe tool:&amp;rdquo;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
