<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>blog.jourdant.me</title>
<link>https://blog.jourdant.me/</link>
<description>Jourdan Templeton&#39;s blog: practical notes on Azure, DevOps, PowerShell, home automation, IoT and data.</description>
<atom:link href="https://blog.jourdant.me/rss/feed.xml" rel="self" type="application/rss+xml"/>
<language>en-NZ</language>
<managingEditor>hello@jourdant.me (Jourdan Templeton)</managingEditor>
<category>Information Technology</category>
<lastBuildDate>Tue, 10 Nov 2026 00:00:00 +0000</lastBuildDate>
<item>
<title>Quickstart: Running Azure DevOps v5 Build Agents on macOS and Apple Silicon</title>
<link>https://blog.jourdant.me/post/quickstart-running-azure-devops-v5-build-agents-on-macos-and-apple-silicon</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/quickstart-running-azure-devops-v5-build-agents-on-macos-and-apple-silicon</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>DevOps</category>
<pubDate>Tue, 10 Nov 2026 00:00:00 +0000</pubDate>
<description>&lt;p&gt;Microsoft has moved the Azure DevOps pipelines agent from version 4.x to &lt;a href=&quot;https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v5-agent?view=azure-devops&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;version 5.x&lt;/a&gt;. I&#39;ve updated the script from my &lt;a href=&quot;https://blog.jourdant.me/post/quickstart-running-azure-devops-build-agents-on-macos-and-apple-silicon&quot;&gt;original quickstart&lt;/a&gt; to match, and it&#39;s still running happily on my Mac Mini.&lt;/p&gt;
&lt;p&gt;Not much has changed. The v5 agent still ships as a native ARM64 build for Apple Silicon and the setup process is the same. There are two things to know before you start.&lt;/p&gt;
&lt;h3 id=&quot;whats-changed-in-v5&quot;&gt;What&#39;s changed in v5?&lt;/h3&gt;
&lt;p&gt;The agent now runs on .NET 10 instead of .NET 8. The runtime is bundled with the agent, so there&#39;s nothing extra to install. It also doesn&#39;t affect what you build. Your pipelines still use whatever SDKs you&#39;ve installed on the machine.&lt;/p&gt;
&lt;p&gt;The bigger one is macOS support. .NET 10 needs macOS 14 Sonoma or later (Sonoma, Sequoia and Tahoe are all supported on both x64 and ARM64). &lt;strong&gt;macOS 13 Ventura is no longer supported.&lt;/strong&gt; If your build Mac is still on Ventura, upgrade macOS before you upgrade the agent.&lt;/p&gt;
&lt;p&gt;It&#39;s worth moving across sooner rather than later too. Only the 5.x agent gets security patches going forward.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;
&lt;p&gt;The install is a single script now. Give it a name and it creates a folder for the agent, downloads and extracts it, then runs the setup and starts the service. Each agent gets its own folder, so you can still run multiple build agents on the same machine without conflicts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note: I&#39;ve tested this with agent 5.281.1 on macOS Sonoma and above.&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;Install script&lt;/h4&gt;
&lt;p&gt;Copy the following into an &lt;code&gt;install-ado-agent.sh&lt;/code&gt; file. There&#39;s nothing to edit.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token shebang important&quot;&gt;#!/usr/bin/env zsh&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#usage: install-ado-agent.sh &amp;lt;agent-name&gt; [agent-version]&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt;

&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_NAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$1&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_VERSION&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${2&lt;span class=&quot;token operator&quot;&gt;:-&lt;/span&gt;${AGENT_VERSION&lt;span class=&quot;token operator&quot;&gt;:-&lt;/span&gt;}&lt;/span&gt;}&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_ARCH&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_ARCH&lt;span class=&quot;token operator&quot;&gt;:-&lt;/span&gt;}&lt;/span&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Usage: &lt;span class=&quot;token variable&quot;&gt;$0&lt;/span&gt; &amp;lt;agent-name&gt; [agent-version]&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#the v5 agent requires macOS 14 (Sonoma) or later&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;MACOS_MAJOR&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;sw_vers &lt;span class=&quot;token parameter variable&quot;&gt;-productVersion&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;cut&lt;/span&gt; -d. &lt;span class=&quot;token parameter variable&quot;&gt;-f1&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;((&lt;/span&gt; MACOS_MAJOR &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;14&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;))&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;macOS &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;sw_vers &lt;span class=&quot;token parameter variable&quot;&gt;-productVersion&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt; is not supported by the v5 agent. Please upgrade to macOS 14 (Sonoma) or later.&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#pick the right package for this Mac (this still detects Apple Silicon if the terminal is running under Rosetta)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_ARCH}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sysctl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; hw.optional.arm64 &lt;span class=&quot;token operator&quot;&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;2&lt;/span&gt;&gt;&lt;/span&gt;/dev/null&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_ARCH&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;osx-arm64&quot;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_ARCH&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;osx-x64&quot;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#look up the latest stable (non pre-release) agent version if one wasn&#39;t specified&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Looking up the latest agent version...&quot;&lt;/span&gt;
    &lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_VERSION&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-fsSL&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://api.github.com/repos/microsoft/azure-pipelines-agent/releases/latest&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-nE&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;s/.*&quot;tag_name&quot;: *&quot;v([^&quot;]+)&quot;.*/&#92;1/p&#39;&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Couldn&#39;t determine the latest version. Pass one in from https://github.com/microsoft/azure-pipelines-agent/releases&quot;&lt;/span&gt;
        &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Installing agent &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&#39; (&lt;span class=&quot;token variable&quot;&gt;${AGENT_ARCH}&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;) into ./&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;...&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#don&#39;t touch an agent that&#39;s already been configured&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;/.agent&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Agent &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&#39; is already configured in ./&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;. Remove it first if you want to reinstall.&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#download and extract the agent if it isn&#39;t already here&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./config.sh&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_FILENAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;vsts-agent-&lt;span class=&quot;token variable&quot;&gt;${AGENT_ARCH}&lt;/span&gt;-&lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;.tar.gz&quot;&lt;/span&gt;
    &lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_URL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://download.agent.dev.azure.com/agent/&lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;/&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Downloading &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_URL}&lt;/span&gt;&#39;...&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-fL&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_URL}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Download failed. Check the agent version.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    xattr &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Extracting...&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;tar&lt;/span&gt; zxf &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Agent files already present. Skipping download.&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#register the agent, then install and start it as a service&lt;/span&gt;
./config.sh
./svc.sh &lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;
./svc.sh start

&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Done. Agent &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&#39; is installed and running from &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;.&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run it from wherever you want your agents to live, passing in the name for your agent:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; ~/ado-agents &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; ~/ado-agents
&lt;span class=&quot;token function&quot;&gt;zsh&lt;/span&gt; ./install-ado-agent.sh ado-au-m3&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That creates &lt;code&gt;~/ado-agents/ado-au-m3&lt;/code&gt; with everything inside it. If you &lt;code&gt;chmod +x&lt;/code&gt; the script, you can drop the &lt;code&gt;zsh&lt;/code&gt; and just run &lt;code&gt;./install-ado-agent.sh ado-au-m3&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Compared to the original script:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The agent name is a parameter. No more editing variables at the top of the file, and you can run the same script again to add a second agent.&lt;/li&gt;
&lt;li&gt;No hardcoded version. The script pulls the latest release from the &lt;a href=&quot;https://github.com/microsoft/azure-pipelines-agent/releases&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;azure-pipelines-agent&lt;/a&gt; repo, which skips pre-releases. To pin a version, pass it as the second argument: &lt;code&gt;zsh ./install-ado-agent.sh ado-au-m3 5.281.1&lt;/code&gt;. The version number is the release tag on that page without the leading &lt;code&gt;v&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It picks the right architecture. Apple Silicon gets the arm64 agent and Intel Macs get x64.&lt;/li&gt;
&lt;li&gt;It does the setup for you. Rather than printing a command for you to run, it goes straight into the config and installs the service.&lt;/li&gt;
&lt;li&gt;It fails early. It stops straight away on macOS older than Sonoma, and &lt;code&gt;curl&lt;/code&gt; now fails cleanly instead of saving an error page as the &lt;code&gt;.tar.gz&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The agent keeps itself up to date once it&#39;s registered, so the version you install is just a starting point.&lt;/p&gt;
&lt;p&gt;Once the download finishes, you&#39;ll be guided through a setup process that has you type in the base URL to your Azure DevOps instance and enter a Personal Access Token (PAT) with permissions to enrol the build agent.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-2.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;To create a PAT with the correct permissions, navigate to &lt;code&gt;https://dev.azure.com/{your_org_name}/_usersSettings/tokens&lt;/code&gt; and click &lt;strong&gt;New Token&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Give it a name and a short expiry is fine, this PAT is only required to enrol the build agent. After this process, the PAT is not required for the on-going running of the build agent.&lt;/p&gt;
&lt;p&gt;The only permission you need for enrolling new build agents is the &lt;strong&gt;Agent Pools: Read &amp;amp; Manage&lt;/strong&gt; scope. This can be found by clicking &lt;strong&gt;Show All&lt;/strong&gt; at the bottom of the scopes list.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-3.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Paste the PAT back into the setup script and continue with the process. It&#39;s important to assign your agent to the correct Agent Pool.&lt;/p&gt;
&lt;p&gt;Unless you have a complicated setup, often assigning to the &lt;strong&gt;Default&lt;/strong&gt; pool is totally fine. You may choose to assign it to a new pool specifically for ARM64 Macs for example.&lt;/p&gt;
&lt;p&gt;Once the configuration is complete, the script will proceed to install the service and start it. You should see that indicated on the output too.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-4.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;You&#39;ll also see that reflected in the Azure DevOps portal immediately with the state of your newly registered agent.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-5.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;At this point, you&#39;re all done! Same recommendation as last time: make sure you have homebrew installed, and make sure it&#39;s the native arm64 homebrew. This will enable all the tasks like &lt;strong&gt;Install Node.js&lt;/strong&gt; to execute correctly from a pipeline.&lt;/p&gt;
&lt;h3 id=&quot;upgrading-an-existing-v4-agent&quot;&gt;Upgrading an existing v4 agent&lt;/h3&gt;
&lt;p&gt;If you set up an agent with my original post, you don&#39;t need to start again. Agents update themselves when a pipeline needs a newer version. You can also kick off an update yourself in the portal under &lt;strong&gt;Organization Settings &amp;gt; Agent pools &amp;gt; {your pool} &amp;gt; Agents &amp;gt; Update all agents&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Be careful if you&#39;re still on Ventura. The automatic update doesn&#39;t check whether your OS supports .NET 10, so the update can fail or the agent might not start afterwards. Upgrade macOS to Sonoma or later first, then update the agent.&lt;/p&gt;
&lt;p&gt;To check which version an agent is on, look at the &lt;strong&gt;Agent version&lt;/strong&gt; column in the agent pool, or run &lt;code&gt;./config.sh --version&lt;/code&gt; from the agent&#39;s directory.&lt;/p&gt;
&lt;p&gt;If you&#39;d rather start fresh, uninstall the old agent (see the FAQ below) and run the script with a new name.&lt;/p&gt;
&lt;h4&gt;Frequently Asked Questions&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Do I need to install .NET 10 first?&lt;/strong&gt; No. Everything the v5 agent needs is bundled with it. The .NET version your pipelines build with depends on the SDKs you&#39;ve installed on the machine.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can I stay on the 4.x agent?&lt;/strong&gt; I wouldn&#39;t. Azure Pipelines regularly ships features that need newer agents, and your pipelines will fail if there&#39;s no agent on the right version. The exception is Azure DevOps Server. The latest Server release still uses the 4.x agent, so stick with my &lt;a href=&quot;https://blog.jourdant.me/post/quickstart-running-azure-devops-build-agents-on-macos-and-apple-silicon&quot;&gt;original post&lt;/a&gt; for now.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can I run the x64 version on my Apple Silicon Mac?&lt;/strong&gt; Yes. I tried this first, but it runs under the Rosetta compatibility runtime. This is less efficient and things don&#39;t work as smoothly. For example, if you need to execute homebrew, it will expect the x64 version and that will expect to install x64 binaries. It&#39;s not worth it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;How do I uninstall an agent?&lt;/strong&gt; Make sure you are in the directory where the agent files were extracted, then run &lt;code&gt;./svc.sh stop&lt;/code&gt; and &lt;code&gt;./svc.sh uninstall&lt;/code&gt;. Then run &lt;code&gt;./config.sh remove&lt;/code&gt; to unregister it from Azure DevOps (or remove it from the portal) and delete the directory.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can an Apple Silicon Mac build for Windows and Linux too?&lt;/strong&gt; Yes. This is why it&#39;s my favourite platform for doing builds. This way a single build agent can compile apps for iOS and macOS, as well as building assets to run on Linux and Windows too. I currently have this working for a number of projects.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can I use the script above for my x64-based device running macOS?&lt;/strong&gt; Yes. The script detects an Intel Mac and downloads the x64 agent for you. You&#39;ll still need Sonoma or later.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;//jourdant&lt;/p&gt;
</description>
</item>
<item>
<title>Downloading files with PowerShell in 2026</title>
<link>https://blog.jourdant.me/post/download-files-with-powershell</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/download-files-with-powershell</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>PowerShell</category>
<pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate>
<description>&lt;p class=&quot;note&quot;&gt;This is the 2026 rewrite of &lt;a href=&quot;https://blog.jourdant.me/post/3-ways-to-download-files-with-powershell&quot;&gt;3 ways to download files with PowerShell&lt;/a&gt;, my most popular post by a long way. It’s been read and referenced hundreds of thousands of times since 2015, and most of its advice no longer holds.&lt;/p&gt;
&lt;p&gt;Back in 2015 I timed three ways to download a file in PowerShell 4 on Windows 8.1. The built-in cmdlet was slow, &lt;code&gt;WebClient&lt;/code&gt; was the pick and BITS was a close second.&lt;/p&gt;
&lt;p&gt;Eleven years on, PowerShell runs on Windows, macOS and Linux, and the slow cmdlet from 2015 is now as quick as anything else. I re-ran the benchmarks and tested every snippet below on Windows 11 and Ubuntu 24.04 with PowerShell 7.6.&lt;/p&gt;
&lt;p&gt;Jump to what you need:&lt;/p&gt;
&lt;ul class=&quot;jump&quot;&gt;
&lt;li class=&quot;key&quot;&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#download-a-file&quot;&gt;Download a file&lt;/a&gt; &lt;span&gt;- most likely what you want&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;key&quot;&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#download-lots-of-files-in-parallel&quot;&gt;Download lots of files in parallel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#resume-a-broken-download&quot;&gt;Resume a broken download&lt;/a&gt; &lt;span&gt;- with retries&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#check-the-download&quot;&gt;Check the download&lt;/a&gt; &lt;span&gt;- compare the SHA-256 hash&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#download-with-curl&quot;&gt;Download with curl&lt;/a&gt; &lt;span&gt;- built into Windows, macOS and Linux&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#still-on-windows-powershell-51&quot;&gt;Still on Windows PowerShell 5.1?&lt;/a&gt; &lt;span&gt;- one line makes it 450 times faster&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#what-about-webclient-and-bits&quot;&gt;What about WebClient and BITS?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell#the-benchmarks&quot;&gt;The benchmarks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-short-answer&quot;&gt;The short answer&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;Invoke-WebRequest&lt;/code&gt; with &lt;code&gt;-OutFile&lt;/code&gt;. In PowerShell 7 it streams straight to disk and keeps pace with curl. It can also resume and retry. If you’re still on Windows PowerShell 5.1, turn the progress bar off first.&lt;/p&gt;
&lt;h2 id=&quot;download-a-file&quot;&gt;Download a file&lt;/h2&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&#39;https://github.com/PowerShell/PowerShell/releases/download/v7.6.9/powershell-7.6.9-linux-x64.tar.gz&#39;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;powershell&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tar&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;gz&lt;/code&gt;&lt;/pre&gt;
&lt;figure&gt;
&lt;video class=&quot;clip&quot; muted=&quot;&quot; loop=&quot;&quot; playsinline=&quot;&quot; disablepictureinpicture=&quot;&quot; disableremoteplayback=&quot;&quot; preload=&quot;none&quot; width=&quot;652&quot; height=&quot;238&quot; poster=&quot;https://blog.jourdant.me/img/post/powershell-download-basic.webp&quot; aria-label=&quot;Terminal recording: Invoke-WebRequest downloads the 70 MB PowerShell release with a progress bar, then Get-FileHash prints its SHA-256 hash.&quot;&gt;&lt;source src=&quot;https://blog.jourdant.me/img/post/powershell-download-basic.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;
&lt;figcaption&gt;Recorded in PowerShell 7.6.9 on Ubuntu 24.04. The same commands work unchanged on Windows.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Forward slashes work on every OS, so &lt;code&gt;./powershell.tar.gz&lt;/code&gt; is fine on Windows too. In a script, use &lt;code&gt;$PSScriptRoot&lt;/code&gt; or &lt;code&gt;Join-Path&lt;/code&gt; to build the path.&lt;/p&gt;
&lt;p&gt;To keep the file name from the URL:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.IO.Path]&lt;/span&gt;::GetFileName&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[uri]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AbsolutePath&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Join-Path&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$PWD&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the download needs a token, pass it as a header. Keep the token in an environment variable or a secret store rather than in the script.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;file&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;zip &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Headers @&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; Authorization = &lt;span class=&quot;token string&quot;&gt;&quot;Bearer &lt;span class=&quot;token variable&quot;&gt;$env&lt;/span&gt;:API_TOKEN&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;check-the-download&quot;&gt;Check the download&lt;/h2&gt;
&lt;p&gt;Most projects publish a SHA-256 hash next to each download. Checking it takes two lines and catches a truncated or tampered file before you run it.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$expected&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&#39;1DA6D6D6035D651F20E70DDEE7C4C15AC6AB8B9FB40EE92240D91263F28A884B&#39;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$actual&lt;/span&gt; = &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Get-FileHash&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;powershell&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tar&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;gz &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Algorithm SHA256&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Hash
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$actual&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$expected&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hash mismatch: got &lt;span class=&quot;token variable&quot;&gt;$actual&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-ne&lt;/code&gt; ignores case, so it doesn’t matter whether the published hash is upper or lower case.&lt;/p&gt;
&lt;h2 id=&quot;resume-a-broken-download&quot;&gt;Resume a broken download&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;-Resume&lt;/code&gt; picks up a partial file where it stopped, and &lt;code&gt;-MaximumRetryCount&lt;/code&gt; retries if the connection drops. Both arrived in PowerShell 6.1, so neither works in Windows PowerShell 5.1.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;powershell&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tar&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;gz &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Resume &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;MaximumRetryCount 5 &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;RetryIntervalSec 2&lt;/code&gt;&lt;/pre&gt;
&lt;figure&gt;
&lt;video class=&quot;clip&quot; muted=&quot;&quot; loop=&quot;&quot; playsinline=&quot;&quot; disablepictureinpicture=&quot;&quot; disableremoteplayback=&quot;&quot; preload=&quot;none&quot; width=&quot;652&quot; height=&quot;282&quot; poster=&quot;https://blog.jourdant.me/img/post/powershell-download-resume.webp&quot; aria-label=&quot;Terminal recording: a download is cancelled with Ctrl+C at 10.6 MB, then Invoke-WebRequest -Resume finishes it at the full 70 MB.&quot;&gt;&lt;source src=&quot;https://blog.jourdant.me/img/post/powershell-download-resume.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;
&lt;figcaption&gt;The download is cancelled with Ctrl+C at 10.6 MB, then &lt;code&gt;-Resume&lt;/code&gt; carries on from there.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;A few things I found while testing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The server has to support range requests. GitHub, Azure Storage and most CDNs do. If it doesn’t, &lt;code&gt;-Resume&lt;/code&gt; quietly starts again from zero.&lt;/li&gt;
&lt;li&gt;If the file is already complete, the server returns 416 (Range Not Satisfiable) and &lt;code&gt;Invoke-WebRequest&lt;/code&gt; errors once its retries run out. The file isn&#39;t touched.&lt;/li&gt;
&lt;li&gt;The resumed file matched the published hash every time.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;download-lots-of-files-in-parallel&quot;&gt;Download lots of files in parallel&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;ForEach-Object -Parallel&lt;/code&gt; runs each download in its own runspace. &lt;code&gt;-ThrottleLimit&lt;/code&gt; sets how many run at once, and &lt;code&gt;$using:&lt;/code&gt; passes in variables from outside the block.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$urls&lt;/span&gt; = @&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;https://github.com/PowerShell/PowerShell/releases/download/v7.6.9/powershell-7.6.9-linux-x64.tar.gz&#39;&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;https://github.com/PowerShell/PowerShell/releases/download/v7.6.9/powershell-7.6.9-linux-arm64.tar.gz&#39;&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;https://github.com/PowerShell/PowerShell/releases/download/v7.6.9/powershell-7.6.9-osx-arm64.tar.gz&#39;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$dest&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Item&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;downloads &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;ItemType Directory &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Force
&lt;span class=&quot;token variable&quot;&gt;$urls&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ForEach-Object&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;ThrottleLimit 8 &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Parallel&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.IO.Path]&lt;/span&gt;::GetFileName&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[uri]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AbsolutePath&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$_&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Join-Path&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$using&lt;/span&gt;:dest &lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;figure&gt;
&lt;video class=&quot;clip&quot; muted=&quot;&quot; loop=&quot;&quot; playsinline=&quot;&quot; disablepictureinpicture=&quot;&quot; disableremoteplayback=&quot;&quot; preload=&quot;none&quot; width=&quot;652&quot; height=&quot;282&quot; poster=&quot;https://blog.jourdant.me/img/post/powershell-download-parallel.webp&quot; aria-label=&quot;Terminal recording: downloading 20 files one at a time takes 9.2 seconds, and with ForEach-Object -Parallel it takes 1.6 seconds.&quot;&gt;&lt;source src=&quot;https://blog.jourdant.me/img/post/powershell-download-parallel.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;
&lt;figcaption&gt;Twenty 2 MB files: 9.2 seconds one at a time, 1.6 seconds eight at a time.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Parallel helps most with lots of small files, where each request spends more time waiting on the server than moving data. On my Windows machine, the same 20 files took 5.7 seconds one at a time, 2.4 seconds four at a time and 1.8 seconds eight at a time. For a few large files on a slow connection, it won’t help much, because you’re already using all the bandwidth.&lt;/p&gt;
&lt;h2 id=&quot;download-with-curl&quot;&gt;Download with curl&lt;/h2&gt;
&lt;p&gt;curl ships with Windows 10 (1803 and later), Windows 11, macOS and nearly every Linux distribution, so it’s handy when you want one command that works the same in PowerShell and bash.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;curl &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fL&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;o powershell&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tar&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;gz &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt;       &lt;span class=&quot;token comment&quot;&gt;# macOS and Linux&lt;/span&gt;
curl&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exe &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fL&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;o powershell&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;tar&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;gz &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt;   &lt;span class=&quot;token comment&quot;&gt;# Windows&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-L&lt;/code&gt; follows redirects (GitHub downloads always redirect) and &lt;code&gt;-f&lt;/code&gt; makes curl fail on an HTTP error instead of saving the error page. curl doesn’t throw a PowerShell error, so check &lt;code&gt;$LASTEXITCODE&lt;/code&gt; afterwards.&lt;/p&gt;
&lt;p&gt;On Windows, type &lt;code&gt;curl.exe&lt;/code&gt; rather than &lt;code&gt;curl&lt;/code&gt;. In Windows PowerShell 5.1, &lt;code&gt;curl&lt;/code&gt; is an alias for &lt;code&gt;Invoke-WebRequest&lt;/code&gt;, which takes completely different parameters.&lt;/p&gt;
&lt;h2 id=&quot;still-on-windows-powershell-51&quot;&gt;Still on Windows PowerShell 5.1?&lt;/h2&gt;
&lt;p&gt;Add one line before you download:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&#39;https://github.com/PowerShell/PowerShell/releases/download/v7.6.9/PowerShell-7.6.9-win-x64.zip&#39;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$ProgressPreference&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&#39;SilentlyContinue&#39;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PSScriptRoot&lt;/span&gt;&#92;PowerShell.zip&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;UseBasicParsing&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In 5.1, drawing the progress bar costs far more than the download itself. A 1 GB file from a local server took &lt;strong&gt;7 minutes 36 seconds&lt;/strong&gt; with the progress bar on and &lt;strong&gt;1 second&lt;/strong&gt; with it off. That’s very likely the slowness I measured in 2015 and blamed on the cmdlet.&lt;/p&gt;
&lt;p&gt;Setting &lt;code&gt;$ProgressPreference&lt;/code&gt; inside a script only affects that script. &lt;code&gt;-UseBasicParsing&lt;/code&gt; stops 5.1 from depending on Internet Explorer, which matters on Server Core. PowerShell 7 ignores it.&lt;/p&gt;
&lt;p&gt;If you get “Could not create SSL/TLS secure channel” on an older server, add this before the download:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token namespace&quot;&gt;[Net.ServicePointManager]&lt;/span&gt;::SecurityProtocol = &lt;span class=&quot;token namespace&quot;&gt;[Net.SecurityProtocolType]&lt;/span&gt;::Tls12&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;what-about-webclient-and-bits&quot;&gt;What about WebClient and BITS?&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;System.Net.WebClient&lt;/code&gt; was my pick in 2015. It still works in PowerShell 7 and it was quick in my tests, but .NET has marked it obsolete since .NET 6, and it can’t resume or retry. Now that &lt;code&gt;Invoke-WebRequest&lt;/code&gt; is just as fast, there’s no reason to reach for it. If you really want the .NET class, &lt;code&gt;System.Net.Http.HttpClient&lt;/code&gt; is the supported one, and it’s what &lt;code&gt;Invoke-WebRequest&lt;/code&gt; uses under the hood anyway.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Start-BitsTransfer&lt;/code&gt; only exists on Windows, and it was the slowest method in both tests. It’s still the right tool for a big transfer that should keep going in the background, survive a reboot or stay under a bandwidth cap. For a script that needs a file now, use &lt;code&gt;Invoke-WebRequest&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-benchmarks&quot;&gt;The benchmarks&lt;/h2&gt;
&lt;p&gt;I ran these on Windows 11 with PowerShell 7.6.9 (.NET 10) and Windows PowerShell 5.1.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Every run started a fresh PowerShell process in its own console window, so progress bars drew just as they do for you.&lt;/li&gt;
&lt;li&gt;The local test downloads a 1 GB file from a small server on the same machine. That takes the network out of it and shows how much overhead each method adds.&lt;/li&gt;
&lt;li&gt;The internet test downloads 50 MB from Cloudflare’s speed test over my connection, which manages about 220 Mbps.&lt;/li&gt;
&lt;li&gt;Figures are medians of five runs (local) or three runs (internet and 5.1).&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;PowerShell 7.6&lt;/th&gt;
&lt;th&gt;1 GB, local&lt;/th&gt;
&lt;th&gt;50 MB, internet&lt;/th&gt;
&lt;th&gt;Peak memory&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Invoke-WebRequest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.77 s&lt;/td&gt;
&lt;td&gt;1.87 s&lt;/td&gt;
&lt;td&gt;125 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Invoke-WebRequest&lt;/code&gt;, progress off&lt;/td&gt;
&lt;td&gt;0.89 s&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;107 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Invoke-RestMethod -OutFile&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.88 s&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;106 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;HttpClient&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1.53 s&lt;/td&gt;
&lt;td&gt;1.72 s&lt;/td&gt;
&lt;td&gt;106 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WebClient&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.85 s&lt;/td&gt;
&lt;td&gt;2.00 s&lt;/td&gt;
&lt;td&gt;103 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;curl.exe&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1.09 s&lt;/td&gt;
&lt;td&gt;1.73 s&lt;/td&gt;
&lt;td&gt;separate process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Start-BitsTransfer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1.40 s&lt;/td&gt;
&lt;td&gt;2.50 s&lt;/td&gt;
&lt;td&gt;separate service&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Windows PowerShell 5.1&lt;/th&gt;
&lt;th&gt;1 GB, local&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Invoke-WebRequest&lt;/code&gt;, progress on&lt;/td&gt;
&lt;td&gt;456 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Invoke-WebRequest&lt;/code&gt;, progress off&lt;/td&gt;
&lt;td&gt;1.00 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WebClient&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.91 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;20 × 2 MB files, PowerShell 7.6&lt;/th&gt;
&lt;th&gt;Internet&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One at a time&lt;/td&gt;
&lt;td&gt;5.74 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-Parallel -ThrottleLimit 4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2.36 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-Parallel -ThrottleLimit 8&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1.76 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;What the numbers say:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On a real connection, every method except BITS finished within 0.3 seconds of the others. The network is the bottleneck, so pick the method for its features.&lt;/li&gt;
&lt;li&gt;Locally, the gaps are a fraction of a second on a 1 GB file. That’s close to run-to-run noise.&lt;/li&gt;
&lt;li&gt;In 2015 I wrote that &lt;code&gt;Invoke-WebRequest&lt;/code&gt; buffered the whole file in memory. It doesn’t now. The whole PowerShell process peaked at 125 MB while downloading 1 GB.&lt;/li&gt;
&lt;li&gt;Peak memory is for the whole PowerShell process. curl and BITS do the download in another process, so their numbers don’t compare.&lt;/li&gt;
&lt;/ul&gt;
</description>
</item>
<item>
<title>Quickstart: Running Azure DevOps Build Agents on macOS and Apple Silicon</title>
<link>https://blog.jourdant.me/post/quickstart-running-azure-devops-build-agents-on-macos-and-apple-silicon</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/quickstart-running-azure-devops-build-agents-on-macos-and-apple-silicon</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>DevOps</category>
<pubDate>Sat, 03 May 2025 13:47:17 +0000</pubDate>
<description>&lt;p&gt;&lt;strong&gt;UPDATE (November 2026): Azure DevOps has moved to the &lt;a href=&quot;https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v5-agent?view=azure-devops&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;v5 build agent&lt;/a&gt;, which runs on .NET 10 and requires macOS 14 Sonoma or later. I&#39;ve written an updated version of this guide: &lt;a href=&quot;https://blog.jourdant.me/post/quickstart-running-azure-devops-v5-build-agents-on-macos-and-apple-silicon&quot;&gt;Quickstart: Running Azure DevOps v5 Build Agents on macOS and Apple Silicon&lt;/a&gt;. The steps below cover the 4.x agent, which you&#39;ll still need on macOS Ventura or with Azure DevOps Server.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&#39;ve been daily driving Macs as my portable device for over a decade. Mainly for their build quality and impressive battery life.&lt;/p&gt;
&lt;p&gt;Apple&#39;s release of Apple Silicon (originally with the M1 chip) took things up a notch. Being ARM64 architecture, the chips perform really well while maintaining a good power per watt ratio. Plus macOS is tuned directly for these chips too. I picked up a Mac Mini with an M2 Pro in it for a home server and it&#39;s handled everything I&#39;ve needed from VMs, Docker containers and more.&lt;/p&gt;
&lt;p&gt;When I needed to setup a macOS build agent for Azure DevOps, the Mac Mini came to mind as a perfect build server too... assuming that it all works natively on ARM64. Good news is, its possible! Here&#39;s how to do it.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;
&lt;p&gt;I&#39;ve tried to shorten all the steps to a single script, then some post config to make the install as easy as possible. It also means you can run multiple build agents on the same machine without conflicts too.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note: I&#39;ve tested this on macOS Ventura and above. If there are breaking changes, I&#39;ll do my best to keep this up-to-date.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note: The script below installs the 4.x agent. For the 5.x agent, use the script in the &lt;a href=&quot;https://blog.jourdant.me/post/quickstart-running-azure-devops-v5-build-agents-on-macos-and-apple-silicon&quot;&gt;updated post&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;Build script&lt;/h4&gt;
&lt;p&gt;Copy the following into an &lt;code&gt;ado-agent.sh&lt;/code&gt; file and update the variables at the beginning for your agent:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token shebang important&quot;&gt;#!/usr/bin/env zsh&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_NAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;air-m2&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_VERSION&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;4.254.0&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_ARCH&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;osx-arm64&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_FILENAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;vsts-agent-&lt;span class=&quot;token variable&quot;&gt;${AGENT_ARCH}&lt;/span&gt;-&lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;.tar.gz&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;BASE_DIR&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${&lt;span class=&quot;token environment constant&quot;&gt;HOME&lt;/span&gt;}&lt;/span&gt;/ado-agents&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#setup directory for agents&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${BASE_DIR}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Creating base agent directory &#39;&lt;span class=&quot;token variable&quot;&gt;${BASE_DIR}&lt;/span&gt;&#39;...&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${BASE_DIR}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${BASE_DIR}&lt;/span&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#download latest agent payload if not already present&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;AGENT_URL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://download.agent.dev.azure.com/agent/&lt;span class=&quot;token variable&quot;&gt;${AGENT_VERSION}&lt;/span&gt;/&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Downloading &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_URL}&lt;/span&gt;&#39; to &#39;&lt;span class=&quot;token variable&quot;&gt;${BASE_DIR}&lt;/span&gt;&#39;...&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_URL}&lt;/span&gt;&quot;&lt;/span&gt;
    xattr &lt;span class=&quot;token parameter variable&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;./&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Agent file &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&#39; already exists. Skipping download.&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#unzip the agent to the correct location if it doesn&#39;t exist&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Extracting agent to &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&#39;...&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;tar&lt;/span&gt; zxvf &lt;span class=&quot;token string&quot;&gt;&quot;../&lt;span class=&quot;token variable&quot;&gt;${AGENT_FILENAME}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Agent directory &#39;&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt;&#39; already exists. Skipping extraction.&quot;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Now run: &#39;cd &lt;span class=&quot;token variable&quot;&gt;${BASE_DIR}&lt;/span&gt;/&lt;span class=&quot;token variable&quot;&gt;${AGENT_NAME}&lt;/span&gt; &amp;amp;&amp;amp; ./config.sh &amp;amp;&amp;amp; ./svc.sh install &amp;amp;&amp;amp; ./svc.sh start&#39;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you don&#39;t want to &lt;code&gt;chmod +x&lt;/code&gt; the script, you can also execute as a one-off &lt;code&gt;zsh ./ado-agent.sh&lt;/code&gt;. After running the script, you should see a message to run a command to configure the agent like below:&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-1.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;When running that command, you&#39;ll be guided through a setup process that has you type in the base URL to your Azure DevOps instance and enter a Personal Access Token (PAT) with permissions to enrol the build agent.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-2.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;To create a PAT with the correct permissions, naviate to &lt;code&gt;https://dev.azure.com/{your_org_name}/_usersSettings/tokens&lt;/code&gt; and click &lt;strong&gt;New Token&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Give it a name and a short expiry is fine, this PAT is only required to enrol the build agent. After this process, the PAT is not required for the on-going running of the build agent.&lt;/p&gt;
&lt;p&gt;The only permission you need for enrolling new build agents is the &lt;strong&gt;Read &amp;amp; Manage&lt;/strong&gt; scope. This can be found by clicking &lt;strong&gt;Show All&lt;/strong&gt; at the bottom of the scopes list.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-3.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Paste the PAT back into the setup script and continue with the process. It&#39;s important to assign your agent to the correct Agent Pool.&lt;/p&gt;
&lt;p&gt;Unless you have a complicated setup, often assigning to the &lt;strong&gt;Default&lt;/strong&gt; pool is totally fine. You may choose to assign it to a new pool specifically for ARM64 Macs for example.&lt;/p&gt;
&lt;p&gt;Once the configuration is complete, the command will proceed to install the service and start it. You should see that indicated on the output too.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-4.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;You&#39;ll also see that reflected in the Azure DevOps portal immediately with the state of your newly registered agent.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ado-5.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;At this point, you&#39;re all done! There are a couple of things I&#39;d recommend doing if you haven&#39;t already to be as best set up as possible. The main one is making sure you have homebrew installed - make sure it is the native arm64 homebrew too. This will enable all the tasks like &lt;strong&gt;Install Node.js&lt;/strong&gt; to execute correctly from a pipeline.&lt;/p&gt;
&lt;h4&gt;Frequently Asked Questions&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can I run the x64 version on my Apple Silicon Mac?&lt;/strong&gt; Yes. I tried this first, but it runs under the Rosetta compatibility runtime. This is less efficient and things don&#39;t work as smoothly. For example, if you need to execute homebrew, it will expect the x64 version and that will expect to install x64 binaries. It&#39;s not worth it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;How do I uninstall an agent?&lt;/strong&gt; There are two commands to run to remove the agent. Make sure you are in the directory where the agent files were extracted: &lt;code&gt;./svc.sh stop&lt;/code&gt; and &lt;code&gt;./svc.sh uninstall&lt;/code&gt;, then feel free to delete the directory and remove the agent from the Azure DevOps console.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can an Apple Silicon Mac build for Windows and Linux too?&lt;/strong&gt; Yes. This is why it&#39;s my favourite platform for doing builds. This way a single build agent can compile apps for iOS and macOS, as well as building assets to run on Linux and Windows too. I currently have this working for a number of projects.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Can I use the script above for my x64-based device running macOS?&lt;/strong&gt; Yes. Just update the architecture from arm64 to x64 in the script above, everything else should work fine.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;//jourdant&lt;/p&gt;
</description>
</item>
<item>
<title>Seamless Home Assistant Backups with Azure Blob Storage</title>
<link>https://blog.jourdant.me/post/seamless-home-assistant-backups-with-azure-blob-storage</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/seamless-home-assistant-backups-with-azure-blob-storage</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>Home Automation</category>
<pubDate>Thu, 31 Oct 2024 18:05:29 +0000</pubDate>
<description>&lt;p&gt;&lt;strong&gt;Update 2025-05-03: This guide is no longer relevant as of Home Assistant version 2025.1. The new backup experience has significantly improved. See here for more detail: &lt;a href=&quot;https://www.home-assistant.io/blog/2025/01/03/3-2-1-backup/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.home-assistant.io/blog/2025/01/03/3-2-1-backup/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is my first post after a long hiatus. In the last few years I have been doing a lot with home automation, more specifically building out integrations and automations on top of &lt;a href=&quot;https://home-assistant.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Home Assistant&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For those who are new to Home Automation and Home Assistant (HA), check out the official &lt;a href=&quot;https://www.home-assistant.io/installation/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Getting Started&lt;/a&gt; page.&lt;/p&gt;
&lt;h3 id=&quot;backups&quot;&gt;Backups&lt;/h3&gt;
&lt;p&gt;Home Assistant is one of the most actively contributed Open Source projects. There are regular updates to both Home Assistant and the addons/integrations/plugins etc. As such I wanted to make sure I had good backup coverage - in case the hardware running the instance failed, or in case of an update going bad.&lt;/p&gt;
&lt;p&gt;For my particular setup, there are two areas where I can perform backups:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;HAOS&lt;/strong&gt; - I am running Home Assistant as a Virtual Machine on an M2 Mac Mini. I prefer HAOS because all the native docker integration works without any interaction from my side. Given this is a VM, I can take VM snapshots prior to potentially destructive tasks which gives me a nice and easy roll-back point.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configuration&lt;/strong&gt; - Home Assistant supports built-in backups which are taken automatically when addon or system updates are installed. You can also initiate checkpoint backups too. this is the option I want to focus on in this post. This is the backup type I&#39;ll be focusing on in this post.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;storage-in-home-assistant&quot;&gt;Storage in Home Assistant&lt;/h3&gt;
&lt;p&gt;HA allows you to set up remote network storage and use that as a backup target. Based on reading the &lt;a href=&quot;https://reddit.com/r/homeassistant&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;/r/homeassistant&lt;/a&gt; and &lt;a href=&quot;https://community.home-assistant.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;HA Commmunity Forums&lt;/a&gt;, many people choose to mount an SMB share from another network device and offload backups there. This would generally be a NAS to upload the backups to.&lt;/p&gt;
&lt;p&gt;I would prefer to have an off-site backup with minimal effort managing another external device. The ideal place for me to land those backups would be an &lt;a href=&quot;https://azure.microsoft.com/en-us/pricing/details/storage/files/#overview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Azure Storage Account&lt;/a&gt; (Azure Files specifically).&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azure-files-1.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;h3 id=&quot;azure-storage-and-smb&quot;&gt;Azure Storage and SMB&lt;/h3&gt;
&lt;p&gt;Azure Storage is Microsoft&#39;s cloud storage offering. It supports file/block level storage as well as a file share offering called Azure Files. This service allows you to remotely mount your Azure Files share using NFS or SMB. This is the feature we&#39;ll be leveraging today.&lt;/p&gt;
&lt;p&gt;If you need help setting up a storage account, refer to: &lt;a href=&quot;https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal&lt;/a&gt; and here to create your Azure Files share: &lt;a href=&quot;https://learn.microsoft.com/azure/storage/files/storage-how-to-use-files-portal&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://learn.microsoft.com/azure/storage/files/storage-how-to-use-files-portal?tabs=azure-portal&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With our Azure Storage account deployed and an Azure Files share created, we should be able to mount the storage within HA and use as a backup target.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-ha-backups-to-azure-storage&quot;&gt;Setting up HA backups to Azure Storage&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;From the Azure Portal, retrieve your Account Name and Account Key.
&lt;img src=&quot;https://blog.jourdant.me/img/post/azure-files-4.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In Home Assistant, click &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;System&lt;/strong&gt; &amp;gt; &lt;strong&gt;Storage&lt;/strong&gt; and click &lt;strong&gt;Add Network Storage&lt;/strong&gt;
&lt;img src=&quot;https://blog.jourdant.me/img/post/azure-files-2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the following details:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Name&lt;/td&gt;
&lt;td&gt;I usually call mine something like &lt;code&gt;azurefiles&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Usage&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Backup&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{your_storage_account_name}.file.core.windows.net&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Protocol&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Samba/Windows (CIFS)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remote Share&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{your_share_name}/{optional_sub_path}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Username&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{your_storage_account_name}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Password&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{your_storage_account_key}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;
&lt;p&gt;Click Connect and HA will validate the details before adding as a mount point.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;System&lt;/strong&gt; &amp;gt; &lt;strong&gt;Backups&lt;/strong&gt; and click &lt;strong&gt;Create Backup&lt;/strong&gt;. Complete a full backup to the mount point you created earlier.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azure-files-3.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;That&#39;s it! Now when you update your add-ons or Home Assistant versions, you&#39;ll have your backups uploaded off-site automatically.&lt;/p&gt;
</description>
</item>
<item>
<title>Preparing Vision Models for Windows ML</title>
<link>https://blog.jourdant.me/post/preparing-vision-models-for-windows-ml</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/preparing-vision-models-for-windows-ml</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>Data Science</category>
<pubDate>Fri, 15 Jun 2018 23:23:24 +0000</pubDate>
<description>&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/windows/uwp/machine-learning/overview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Windows ML&lt;/a&gt; (WinML) provides a simple managed API for interfacing with machine learning (ML) models. WinML has the ability to read the model metadata and add helpful wrappers around the inputs. This post will cover how a model needs to be structured for WinML to enable these simple bindings.&lt;/p&gt;
&lt;h2 id=&quot;input-bindings&quot;&gt;Input Bindings&lt;/h2&gt;
&lt;p&gt;As mentioned, WinML can read metadata from the model. We are interested in the expected inputs and outputs from the model graph. A simple binding for a vision model would look like the following:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//instantiate model&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; modelUri &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Uri&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;ms-appx:///Assets/model.onnx&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; modelFile &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; StorageFile&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetFileFromApplicationUriAsync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;modelUri&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; model &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; LearningModelPreview&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;LoadModelFromStorageFileAsync&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;modelFile&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; modelBinding &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;LearningModelBindingPreview&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;model&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;//get input metadata&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; inputImage &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ImageVariableDescriptorPreview&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;model&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Description&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;InputFeatures
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;FirstOrDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;f &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; f&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ModelFeatureKind &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; LearningModelFeatureKindPreview&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Image&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;//convert softwareBitmap to VideoFrame and bind to model&lt;/span&gt;
modelBinding&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;inputImage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; VideoFrame&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateWithSoftwareBitmap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/*softwareBitmap*/&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;inputImage&lt;/strong&gt; (&lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.imagevariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ImageVariableDescriptorPreview&lt;/a&gt;) contains a number of properties such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Name&lt;/strong&gt; - Internal name for the input in the model graph&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BitmapPixelFormat&lt;/strong&gt; - Image format and number of channels&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Height&lt;/strong&gt; - Expected pixel height of input image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width&lt;/strong&gt; - Expected pixel width of input image&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;WinML has a number of types that can be easily bound to a model including: &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.imagevariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ImageVariableDescriptorPreview&lt;/a&gt;, &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.mapvariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;MapVariableDescriptorPreview&lt;/a&gt;, &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.sequencevariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;SequenceVariableDescriptorPreview&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.tensorvariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;TensorVariableDescriptorPreview&lt;/a&gt;. These are automatically detected by WinML based on the size and ordering of the input tensor.&lt;/p&gt;
&lt;h2 id=&quot;input-tensor&quot;&gt;Input Tensor&lt;/h2&gt;
&lt;p&gt;For WinML to detect &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.imagevariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ImageVariableDescriptorPreview&lt;/a&gt; as the input binding, the input tensor needs to be in a specific order:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/ML_1_1a.png&quot; alt=&quot;model graph&quot; /&gt;
The input tensor must be four-dimensional. The ordered dimensions refer to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;float[1, &amp;lt;RGB Channels&amp;gt;, &amp;lt;Pixels Height&amp;gt;, &amp;lt;Pixels Width&amp;gt;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/lutzroeder/Netron&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Netron&lt;/a&gt;, written by &lt;a href=&quot;https://www.lutzroeder.com/ai/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Lutz Roeder&lt;/a&gt;, is a great tool for inspecting your ONNX model. Inspect the model graph and make sure that the input tensor is in the correct format.&lt;/p&gt;
&lt;p&gt;I have tested different ordering on the input tensor and WinML no longer detects it as an &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.imagevariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ImageVariableDescriptorPreview&lt;/a&gt;. It is still possible to use models in those formats, however you either need to rebuild the graph to use the format mentioned above, or use a &lt;a href=&quot;https://docs.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.tensorvariabledescriptorpreview&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;TensorVariableDescriptorPreview&lt;/a&gt;. The second option requires a manual process to extract the bytes per channel and bind them into the model.&lt;/p&gt;
&lt;p&gt;Jourdan&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;</description>
</item>
<item>
<title>Loading data from files in SharePoint</title>
<link>https://blog.jourdant.me/post/loading-data-from-files-in-sharepoint</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/loading-data-from-files-in-sharepoint</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>Power BI</category>
<pubDate>Fri, 07 Apr 2017 00:06:19 +0000</pubDate>
<description>&lt;p&gt;Working collaboratively on a set of reports in Power BI can be a complicated exercise. I find most issues occur when people are trying to share the same non-SQL data source.&lt;/p&gt;
&lt;p&gt;If you&#39;re querying a SQL database, sharing the data connection is quite simple. However, what do you do if your data is sitting in a spreadsheet? Loading data from a CSV or spreadsheet is a perfectly valid scenario.&lt;/p&gt;
&lt;p&gt;There are a number of options within Power BI to accomplish this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reference a local file with &lt;a href=&quot;https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Query Parameters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Upload your file to a public website&lt;/li&gt;
&lt;li&gt;Upload your file to a SharePoint Document Library&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is not an exhaustive list. For this post, I&#39;ll be focusing on the last option - loading data from files in a SharePoint document library.&lt;/p&gt;
&lt;h2 id=&quot;preparation&quot;&gt;Preparation&lt;/h2&gt;
&lt;p&gt;To begin this exercise, you will need to upload some data to SharePoint.&lt;/p&gt;
&lt;p&gt;I have selected a public dataset from the &lt;a href=&quot;https://www.nzqa.govt.nz/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;New Zealand Qualifications Authority (NZQA)&lt;/a&gt; - &amp;quot;Literacy and Numeracy 2015: School&amp;quot;. This dataset contains the average Math and English scores of High School students in 2015, broken down by school.&lt;/p&gt;
&lt;p&gt;Download the dataset found here: &lt;a href=&quot;http://www.nzqa.govt.nz/assets/Studying-in-NZ/Secondary-school-and-NCEA/stats-reports/2015/Literacy-and-Numeracy-Statistics-School-2015-28042016.csv&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Literacy and Numeracy 2015: School&lt;/a&gt; and place it into your document library in SharePoint.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/pbi-sp-1.png&quot; alt=&quot;Power BI&quot; /&gt;&lt;/figure&gt;
&lt;h2 id=&quot;instructions&quot;&gt;Instructions&lt;/h2&gt;
&lt;h3 id=&quot;1-build-the-url&quot;&gt;1. Build the URL&lt;/h3&gt;
&lt;p&gt;The most complicated part of this process is getting the right SharePoint URL. The direct URL for SharePoint is built from three components: &lt;code&gt;&amp;lt;domain&amp;gt;/&amp;lt;site and folder&amp;gt;/&amp;lt;filename&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;First, browse to the directory in SharePoint where you uploaded the file. Copy the URL. It should be similar to the URL below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;https://&amp;lt;site&amp;gt;.sharepoint.com/sites/PowerBIShowcase/Shared%20Documents/Forms/AllItems.aspx?id=%2Fsites%2FPowerBIShowcase%2FShared%20Documents%2FGeneral
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next we need to put together each component of the direct URL:&lt;/p&gt;
&lt;h4&gt;Domain&lt;/h4&gt;
&lt;p&gt;Taken from the beginning of the URL.&lt;br /&gt;
Sample: &lt;code&gt;https://&amp;lt;subdomain&amp;gt;.sharepoint.com&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;Site and Folder&lt;/h4&gt;
&lt;p&gt;Taken from the id attribute of the URL and replace %2F with a forward slash (/).&lt;br /&gt;
Sample: &lt;code&gt;/sites/PowerBIShowcase/Shared%20Documents/General&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;Filename&lt;/h4&gt;
&lt;p&gt;This is the name of the file you uploaded earlier.&lt;br /&gt;
Sample: &lt;code&gt;/Literacy-and-Numeracy-Statistics-School-2015-28042016.csv&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you combine these three elements into a single URL and paste into your browser, the file should begin downloading (after authenticating).&lt;/p&gt;
&lt;h3 id=&quot;2-add-a-new-data-source-to-power-bi&quot;&gt;2. Add a new data source to Power BI&lt;/h3&gt;
&lt;p&gt;Use the &#39;Web&#39; datasource and enter the URL built above.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/pbi-sp-2.png&quot; alt=&quot;Power BI&quot; /&gt;&lt;/figure&gt;
&lt;h3 id=&quot;3-authenticate-with-a-work-account&quot;&gt;3. Authenticate with a Work Account&lt;/h3&gt;
&lt;p&gt;Power BI requires credentials to access the file in SharePoint. Log in with a Work Account that has access to the site where your document is stored.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/pbi-sp-3.png&quot; alt=&quot;Power BI&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Note: For the purposes of developing your reports, using your own credentials is fine. You will be prompted for credentials again after publishing. This is where you would enter details for a service account.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;publishing&quot;&gt;Publishing&lt;/h2&gt;
&lt;p&gt;Publish your report into your Power BI workspace.&lt;/p&gt;
&lt;iframe width=&quot;770&quot; height=&quot;490&quot; src=&quot;https://app.powerbi.com/view?r=eyJrIjoiMjNhODA4MTUtMTNiZS00ZmM4LWI3ZGQtNzE4Nzk0ZjZhMGVhIiwidCI6ImRhYjE2N2QyLWZkYWItNGFiNS1hMzg3LTIyZjk1NTQzNmQwYSJ9&quot; frameborder=&quot;0&quot; style=&quot;2px solid #d3d3d3;&quot; allowFullScreen=&quot;true&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;p&gt;If your report requires data to be updated from the SharePoint file, you will need to configure the Schedule Refresh settings.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/pbi-sp-5.png&quot; alt=&quot;Power BI&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Click &amp;quot;Edit Credentials&amp;quot; and make sure you select OAuth2 as the authentication type. Enter your Service Account (Work Account) credentials and hit save.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/pbi-sp-6.png&quot; alt=&quot;Power BI&quot; /&gt;&lt;/figure&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;If you&#39;ve followed all the instructions, you now have a report that supports a scheduled refresh directly out of a SharePoint document library.&lt;/p&gt;
&lt;p&gt;When it comes to sharing your PBIX files, colleagues that have access to the file in SharePoint can easily collaborate.&lt;/p&gt;
&lt;p&gt;Jourdan&lt;/p&gt;
</description>
</item>
<item>
<title>Simple SQL in PowerShell</title>
<link>https://blog.jourdant.me/post/simple-sql-in-powershell</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/simple-sql-in-powershell</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>PowerShell</category>
<pubDate>Sun, 24 Apr 2016 20:24:00 +0000</pubDate>
<description>&lt;p&gt;With the release of Microsoft SQL 2016 looming, I&#39;ve been keeping an eye on the SQL PowerShell cmdlets. In particular, &lt;strong&gt;&lt;a href=&quot;https://msdn.microsoft.com/en-nz/library/cc281720.aspx&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Invoke-Sqlcmd&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I was disappointed however, to find the cmdlets are still only included when installed with the SQL Management Objects. It seems that this cmdlet has been designed to fill the gap between batch files + sqlcmd.exe and more modern PowerShell.&lt;/p&gt;
&lt;p&gt;One of my rules when writing PowerShell is that the script should run on any machine without requiring special things to be installed. Based on this rule, I have written a small function. The only dependency is the .NET framework, as long as you&#39;re running on Windows 7/Server 2008+, you should be good to go.&lt;/p&gt;
&lt;h2 id=&quot;invoke-sqlcommand&quot;&gt;Invoke-SqlCommand&lt;/h2&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;#
.SYNOPSIS
    Performs a SQL query and returns an array of PSObjects.
.NOTES
    Author: Jourdan Templeton - hello@jourdant.me
.LINK 
    https://blog.jourdant.me/post/simple-sql-in-powershell
#&gt;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Invoke-SqlCommand&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;cmdletbinding&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;DefaultParameterSetName=&lt;span class=&quot;token string&quot;&gt;&quot;integrated&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Param&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token namespace&quot;&gt;[Parameter(Mandatory=$true)]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;Alias&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Serverinstance&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Server&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token namespace&quot;&gt;[Parameter(Mandatory=$true)]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Database&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;Parameter&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Mandatory=&lt;span class=&quot;token boolean&quot;&gt;$true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ParameterSetName=&lt;span class=&quot;token string&quot;&gt;&quot;not_integrated&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;Parameter&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Mandatory=&lt;span class=&quot;token boolean&quot;&gt;$true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ParameterSetName=&lt;span class=&quot;token string&quot;&gt;&quot;not_integrated&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Password&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;Parameter&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Mandatory=&lt;span class=&quot;token boolean&quot;&gt;$false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ParameterSetName=&lt;span class=&quot;token string&quot;&gt;&quot;integrated&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[switch]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$UseWindowsAuthentication&lt;/span&gt; = &lt;span class=&quot;token boolean&quot;&gt;$true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token namespace&quot;&gt;[Parameter(Mandatory=$true)]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token namespace&quot;&gt;[Parameter(Mandatory=$false)]&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[int]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$CommandTimeout&lt;/span&gt;=0
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;#build connection string&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$connstring&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;Server=&lt;span class=&quot;token variable&quot;&gt;$Server&lt;/span&gt;; Database=&lt;span class=&quot;token variable&quot;&gt;$Database&lt;/span&gt;; &quot;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$PSCmdlet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ParameterSetName &lt;span class=&quot;token operator&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;not_integrated&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$connstring&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;User ID=&lt;span class=&quot;token variable&quot;&gt;$username&lt;/span&gt;; Password=&lt;span class=&quot;token variable&quot;&gt;$password&lt;/span&gt;;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;ElseIf&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$PSCmdlet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ParameterSetName &lt;span class=&quot;token operator&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;integrated&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$connstring&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Trusted_Connection=Yes; Integrated Security=SSPI;&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;#connect to database&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$connection&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SqlClient&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SqlConnection&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$connstring&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Open&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;#build query object&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$command&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CreateCommand&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$command&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommandText = &lt;span class=&quot;token variable&quot;&gt;$Query&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$command&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommandTimeout = &lt;span class=&quot;token variable&quot;&gt;$CommandTimeout&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;#run query&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$adapter&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SqlClient&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SqlDataAdapter &lt;span class=&quot;token variable&quot;&gt;$command&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$dataset&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DataSet
    &lt;span class=&quot;token variable&quot;&gt;$adapter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Fill&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$dataset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;out-null&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;#return the first collection of results or an empty array&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$dataset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Tables&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$table&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$dataset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Tables&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;0&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;ElseIf&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$table&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rows&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count &lt;span class=&quot;token operator&quot;&gt;-eq&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$table&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collections&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ArrayList &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;token variable&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Close&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$table&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://gist.github.com/jourdant/e9fa625fec54deb1a31f8e441157fc9f&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;View on GitHub Gist&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;
&lt;p&gt;Using the cmdlet is quite simple and can be used with either Windows or SQL auth:&lt;/p&gt;
&lt;h4&gt;Input&lt;/h4&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$server&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;server&gt;.database.windows.net&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$db&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;database&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$sql&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;SELECT TOP 5 * FROM [Index]&quot;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Invoke-SqlCommand&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Server &lt;span class=&quot;token variable&quot;&gt;$server&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Database &lt;span class=&quot;token variable&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Username &lt;span class=&quot;token variable&quot;&gt;$user&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Password &lt;span class=&quot;token variable&quot;&gt;$pass&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Query &lt;span class=&quot;token variable&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Format-Table&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;Output&lt;/h4&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/pssql-1.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;I&#39;ve been doing some work in the BI space lately. I&#39;ve found it interesting to use unconventional data sources (like logs or output from other cmdlets etc). Then using PowerShell to clean/normalise the data and finally, plugging a reporting tool in over the top.&lt;/p&gt;
&lt;p&gt;PowerShell is a great language for bridging operational scripts with a database for reporting (especially when your report is at the PoC stage). This code makes it super easy to plug your PowerShell script into an Azure SQL DB too.&lt;/p&gt;
&lt;p&gt;Let me know what interesting uses you find for this cmdlet!&lt;/p&gt;
&lt;h4&gt;UPDATE 05/05/2016&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://www.reddit.com/r/PowerShell/comments/4hxogo/simple_sql_in_powershell/d2tf1wv&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Thanks to danekan on Reddit&lt;/a&gt;, I have updated the gist above to create an alias for the -ServerInstance param. This makes my code somewhat interchangeable with the Invoke-SqlCmd cmdlet without major changes.&lt;/p&gt;
&lt;p&gt;Adding the following line to your existing scripts that use Invoke-SqlCmd to complete the transformation: &lt;code&gt;New-Alias Invoke-SqlCmd Invoke-SqlCommand -Force&lt;/code&gt;. &lt;strong&gt;Just a quick disclaimer however: I have not intentionally made this to be at full feature parity with Invoke-SqlCmd, therefore your mile may vary :)&lt;/strong&gt;&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>3 ways to download files with PowerShell</title>
<link>https://blog.jourdant.me/post/3-ways-to-download-files-with-powershell</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/3-ways-to-download-files-with-powershell</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>PowerShell</category>
<pubDate>Fri, 03 Apr 2015 00:26:00 +0000</pubDate>
<description>&lt;p class=&quot;note&quot;&gt;&lt;strong&gt;Updated for 2026:&lt;/strong&gt; I wrote this in 2015 for PowerShell 4, and most of it no longer applies. For PowerShell 7 on Windows, macOS and Linux, with new benchmarks and tested snippets, read &lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell&quot;&gt;Downloading files with PowerShell in 2026&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Perhaps the greatest strength of PowerShell is it&#39;s foundation on the .NET framework. The .NET framework enables almost unlimited possibilites inside the scripting realm. This blessing can equally be a curse as things can get complicated. Fast.&lt;/p&gt;
&lt;p&gt;This post will describe three methods for downloading files using PowerShell - weighed up with their pros and cons.&lt;/p&gt;
&lt;h3 id=&quot;test-setup&quot;&gt;Test setup&lt;/h3&gt;
&lt;p&gt;Today&#39;s testing is not highly scientific. The point is to show the difference in execution time and performance.&lt;/p&gt;
&lt;p&gt;The test setup consists of PowerShell 4 running on Windows 8.1 x64 with my VDSL connection curently synced at 35.9/10.4 mbps.&lt;/p&gt;
&lt;p&gt;I will be downloading a test file from &lt;a href=&quot;http://mirror.internode.on.net/pub/test/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Internode&lt;/a&gt; at the following URL: &lt;a href=&quot;http://mirror.internode.on.net/pub/test/10meg.test&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;http://­mirror.­internode­.on.­net/­pub/­test/­10­m­e­g­.­t­e­s­t&lt;/a&gt;. The scripts will be executed 10 times each with the average displayed as the result.&lt;/p&gt;
&lt;p&gt;Let&#39;s get started!
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;1-invoke-webrequest&quot;&gt;1. Invoke-WebRequest&lt;/h3&gt;
&lt;p&gt;The first and most obvious option is the Invoke-WebRequest cmdlet. It is built into PowerShell and can be used in the following method:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;http://mirror.internode.on.net/pub/test/10meg.test&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PSScriptRoot&lt;/span&gt;&#92;10meg.test&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$start_time&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-Date&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Uri &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;OutFile &lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Write-Output&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Time taken: &lt;span class=&quot;token function&quot;&gt;$&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Get-Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;.Subtract(&lt;span class=&quot;token variable&quot;&gt;$start_time&lt;/span&gt;).Seconds) second(s)&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Time taken: 27 seconds&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;Pros&lt;/h4&gt;
&lt;p&gt;With the cmdlet already available it is super easy to get started and use. Integration with Write-Progress is handy while watching &lt;s&gt;paint dry&lt;/s&gt; scripts run (assuming you know the total file size). Cookies can also be persisted between mutiple requests through the use of the &lt;strong&gt;-Session&lt;/strong&gt; and &lt;strong&gt;-WebSession&lt;/strong&gt; parameters.
&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2015-04-03-at-4-26-31-pm.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;h4&gt;Cons&lt;/h4&gt;
&lt;p&gt;Speed. This cmdlet is slow. From what I have observed, the HTTP response stream  is buffered into memory. Once the file has been fully loaded, it is flushed to disk. This adds a huge performance hit and potential memory issues for large files. &lt;strong&gt;If anyone knows specifics on how this cmdlet operates, let me know!&lt;/strong&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2015-04-03-at-4-26-16-pm.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Another potentially serious con for this method is the reliance on Internet Explorer. For example, this cmdlet cannot be used on Windows Server Core edition servers as the Internet Explorer binaries are not included by default. In some cases you can use the &lt;strong&gt;-UseBasicParsing&lt;/strong&gt; parameter, but it does not work in all cases.&lt;/p&gt;
&lt;h4&gt;Verdict&lt;/h4&gt;
&lt;p&gt;This cmdlet shines when you need to persist cookies across multiple requests (for instance HTTP Forms Auth before downloading the file).&lt;/p&gt;
&lt;p&gt;Performance is &lt;em&gt;good enough&lt;/em&gt; for small downloads, but there are definitely better options for situations where speed is required. If the script is to be run on a server running Windows Server Core, choose a more universal method.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;2-systemnetwebclient&quot;&gt;2. System.Net.WebClient&lt;/h3&gt;
&lt;p&gt;A common .NET class used for downloading files is the &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/system.net.webclient.aspx&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;System.Net.WebClient&lt;/a&gt; class.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;http://mirror.internode.on.net/pub/test/10meg.test&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PSScriptRoot&lt;/span&gt;&#92;10meg.test&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$start_time&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-Date&lt;/span&gt;

&lt;span class=&quot;token variable&quot;&gt;$wc&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Net&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;WebClient
&lt;span class=&quot;token variable&quot;&gt;$wc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DownloadFile&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#OR&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Net&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;WebClient&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DownloadFile&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Write-Output&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Time taken: &lt;span class=&quot;token function&quot;&gt;$&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Get-Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;.Subtract(&lt;span class=&quot;token variable&quot;&gt;$start_time&lt;/span&gt;).Seconds) second(s)&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Time taken: 7 seconds&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;Pros&lt;/h4&gt;
&lt;p&gt;This method is also easy to use. Not as syntactically nice as Invoke-RestMethod - yet can still be executed on a single line. Speed is great as the HTTP response stream is buffered to disk throughout the download process.&lt;/p&gt;
&lt;p&gt;There is also the option of &lt;strong&gt;System.Net.WebClient.DownloadFileAsync()&lt;/strong&gt;. This can be very handy if you&#39;d like your script to continue while the file downloads in parallel.&lt;/p&gt;
&lt;h4&gt;Cons&lt;/h4&gt;
&lt;p&gt;There is no visible progress indicator (or any way to query the progress mid transfer). It essentially blocks the thread until the download completes or fails. This isn&#39;t a major con, however sometimes it is handy to know how far through the transfer you are.&lt;/p&gt;
&lt;h4&gt;Verdict&lt;/h4&gt;
&lt;p&gt;System.Net.WebClient is my preferred option when file downloads are required. Anything that increases the performance of my scripts is a winner in my books. This method is also fully compatible on Server Core machines and 100% compatible with your Azure Automation runbooks.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;3-start-bitstransfer&quot;&gt;3. Start-BitsTransfer&lt;/h3&gt;
&lt;p&gt;If you haven&#39;t heard of BITS before, &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/aa362708.aspx&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;check this out&lt;/a&gt;. BITS is primarily designed for asynchronous file downloads, but works perfectly fine synchronously too (assuming you have BITS enabled).&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;http://mirror.internode.on.net/pub/test/10meg.test&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PSScriptRoot&lt;/span&gt;&#92;10meg.test&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$start_time&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-Date&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Import-Module&lt;/span&gt; BitsTransfer
&lt;span class=&quot;token function&quot;&gt;Start-BitsTransfer&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Source &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Destination &lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#OR&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Start-BitsTransfer&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Source &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Destination &lt;span class=&quot;token variable&quot;&gt;$output&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Asynchronous

&lt;span class=&quot;token function&quot;&gt;Write-Output&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Time taken: &lt;span class=&quot;token function&quot;&gt;$&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Get-Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;.Subtract(&lt;span class=&quot;token variable&quot;&gt;$start_time&lt;/span&gt;).Seconds) second(s)&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Time taken: 6 seconds&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;Pros&lt;/h4&gt;
&lt;p&gt;This method proved to be the fastest in my test cases! Extensive integration with Write-Progress gives you a clear indicator of the file size and progress. The &lt;strong&gt;-Asynchronous&lt;/strong&gt; flag can be used to queue transfers asychronously. This method is also incredibly flexible supporting separate credentials for the destination server AND web proxy, if required.&lt;/p&gt;
&lt;p&gt;Personally, the biggest benefit to using the Start-BitsTransfer method is the ability to set retry actions on failure and limiting the amount of bandwidth available to a transfer.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2015-04-03-at-5-04-07-pm.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;h4&gt;Cons&lt;/h4&gt;
&lt;p&gt;While BITS is enabled by default on many machines, you can&#39;t guarantee it is enabled on all (unless you are actively managing this). Also with the way BITS is designed, if other BITS jobs are running in the background, your job could be queued or run at a later time hindering the execution of your script.&lt;/p&gt;
&lt;h4&gt;Verdict&lt;/h4&gt;
&lt;p&gt;This method is perfect for scenarios where you want to limit the bandwidth used in a file download or where time isn&#39;t a major issue. I have used this to sync files nightly at full speed and during the day at half speed using Transfer Policies. BITS is also easy to monitor and audit.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;We can see the obvious/easiest choice isn&#39;t always the best. I would recommend System.Net.WebClient due to it&#39;s universal nature and performance. BITS my second choice due to it&#39;s flexibility and managability.&lt;/p&gt;
&lt;p&gt;Do you know other methods? Let me know!&lt;/p&gt;
&lt;p class=&quot;note&quot;&gt;This post is kept as it was in 2015. The &lt;a href=&quot;https://blog.jourdant.me/post/download-files-with-powershell&quot;&gt;2026 update&lt;/a&gt; covers what I would use today.&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Introduction to ESP8266 and NodeMcu</title>
<link>https://blog.jourdant.me/post/introduction-to-esp8266-and-nodemcu</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/introduction-to-esp8266-and-nodemcu</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>IoT</category>
<pubDate>Sun, 18 Jan 2015 05:39:00 +0000</pubDate>
<description>&lt;p&gt;Simply put, the ESP8266 is a $3 wifi enabled micro-controller. Oh, and the firmware has also been released open source!&lt;/p&gt;
&lt;p&gt;News and code samples have been popping up all over the internet in the last few months. My favourite source of ESP news is &lt;a href=&quot;http://hackaday.com/tag/esp8266/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;hackaday&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.aliexpress.com/item/2PCS-ESP8266-Serial-Esp-01-WIFI-Wireless-Transceiver-Module-Send-Receive-LWIP-AP-STA/32232009463.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ESP-01&lt;/a&gt; is the most common module available and to be honest, &lt;strong&gt;it took me hours to get started&lt;/strong&gt;. There didn&#39;t seem to be a definitive guide on getting it to work! Sweat and stubborness eventually led to success.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/esp01.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;For anyone trying to get the ESP-01 working:&lt;/strong&gt; Supply at least 300mA at 3.3v. Then connect the CH_PD pin to VCC. This is enough to get the chip running. To flash a firmware, use a &lt;strong&gt;3.3v&lt;/strong&gt; USB-&amp;gt;Serial adapter (&lt;a href=&quot;https://www.sparkfun.com/products/9873&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;this adapter&lt;/a&gt; works great for me). A baud rate of 9600 worked on every ESP-01 so far.&lt;/p&gt;
&lt;p&gt;The most appealing project in development however, is the &lt;a href=&quot;https://github.com/nodemcu/nodemcu-firmware/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;NodeMcu firmware&lt;/a&gt;. NodeMcu is a &lt;a href=&quot;http://www.lua.org/docs.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Lua&lt;/a&gt; interpreter, sitting on top of the base firmware, that makes programming the chip a cinch.&lt;/p&gt;
&lt;p&gt;Connecting to a wifi network is as simple as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;wifi.setmode(wifi.STATION)
wifi.sta.config(&amp;quot;NETWORKNAME&amp;quot;, &amp;quot;password!&amp;quot;)
wifi.sta.connect()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Imagine the IoT possibilities...
&lt;br /&gt;&lt;/p&gt;
&lt;h4&gt;NodeMcu Devkit&lt;/h4&gt;
&lt;p&gt;One of the big turn-offs for people wanting to try an ESP8266 based module is all the manual setup of components and power sources.&lt;/p&gt;
&lt;p&gt;NodeMcu has also designed it&#39;s own development board - the NodeMcu Devkit. It contains all the components necessary to power and program the device. It also has all the pins available on breadboard compatible headers!&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/nodemcu_devkit1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;My devkit arrived the other day. It is extremely easy to get started and use. Future posts will feature some projects based on this board.&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Going paperless with Tesseract OCR</title>
<link>https://blog.jourdant.me/post/powershell-and-tesseract-going-paperless-with-ocr</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/powershell-and-tesseract-going-paperless-with-ocr</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>PowerShell</category>
<pubDate>Sun, 04 Jan 2015 00:38:00 +0000</pubDate>
<description>&lt;p&gt;&lt;a href=&quot;https://github.com/jourdant/powershell-paperless&quot;&gt;&lt;div class=&quot;github&quot;&gt;&lt;span&gt;Find the code for this project at:  &lt;u&gt;jourdant/powershell-paperless&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The New Year period always prompts me to look for improvements I could make in my life. After some searching, I came across this article &lt;a href=&quot;http://www.ibaset.com/steps-to-paperless-culture/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;&amp;quot;Three Steps Toward a Paperless Culture&amp;quot;&lt;/a&gt;. A quick glance at my immediate surroundings confirmed that becoming paperless would be a great improvement for my lifestyle. Imagine all those paper records gone!&lt;/p&gt;
&lt;p&gt;In New Zealand, there are &lt;a href=&quot;http://www.aranz.org.nz/site/resources/general/recordkeeping_legislation.aspx#H52094-2&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;laws&lt;/a&gt; requiring you to keep business related records for at least seven years. Potentially this could become an insurmountable mountain of paper - a nightmare to sort, store and retrieve.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/paperstack.jpg&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
(A very small sample shown above, trying to flatten with weights...)&lt;/p&gt;
&lt;p&gt;My scripting mind immediately took control seeking a solution to this problem. &lt;strong&gt;Assuming I had a folder full of scanned documents, how hard would it be to sort them?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As it turns out, &lt;strong&gt;very easy&lt;/strong&gt;.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;tesseract&quot;&gt;Tesseract&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://code.google.com/p/tesseract-ocr/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Tesseract&lt;/a&gt; is my OCR library of choice. Originally developed by HP, Tesseract was later improved and maintained by Google.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/charlesw/tesseract&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;tesseract-ocr&lt;/a&gt; is a .NET wrapper for Tesseract by Charles Weld. We will be using this library with PowerShell to perform our OCR tasks.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;environment&quot;&gt;Environment&lt;/h3&gt;
&lt;p&gt;If you want to proceed through this step quickly, I would suggest downloading and running the &lt;a href=&quot;https://github.com/jourdant/powershell-paperless/blob/master/Initialize-Environment.ps1&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Initialize-Environment.ps1&lt;/a&gt; script from my GitHub repo.&lt;/p&gt;
&lt;p&gt;If you prefer to set everything up manually, create the following directory structure:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{Base Directory} /
    -Input/
    -Lib/
        -tessdata/
        -x86/
        -x64/
    -Output/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will need to download the &lt;a href=&quot;https://www.nuget.org/packages/Tesseract/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;tesseract nuget package&lt;/a&gt; and copy the files to your Lib folder. Then download the &lt;a href=&quot;https://code.google.com/p/tesseract-ocr/downloads/detail?name=tesseract-ocr-3.02.eng.tar.gz&amp;amp;can=2&amp;amp;q=&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Tesseract libraries&lt;/a&gt; and grab just the tessdata folder in the language of your choice (I chose English). Place this folder also into the Lib directory.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;reading-text-from-an-image&quot;&gt;Reading text from an image&lt;/h3&gt;
&lt;p&gt;Reading text from an image is as simple as loading an image, passing it to Tesseract and receiving the output. For example:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#Import System.Drawing and Tesseract libraries&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Add-Type&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;AssemblyName &lt;span class=&quot;token string&quot;&gt;&quot;System.Drawing&quot;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Add-Type&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token string&quot;&gt;&quot;.&#92;Lib&#92;Tesseract.dll&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#Create tesseract object, specify tessdata location and language&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$tesseract&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; Tesseract&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TesseractEngine&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Get-Item&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;.&#92;Lib&#92;tessdata&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FullName&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;eng&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;[Tesseract.EngineMode]&lt;/span&gt;::Default&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#Load and process image&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$image&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-Object&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Drawing&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bitmap&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test.jpg&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$pix&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[Tesseract.PixConverter]&lt;/span&gt;::ToPix&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$page&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$tesseract&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$pix&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#Get text&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$text&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;GetText&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$confidence&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;GetMeanConfidence&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#Cleanup&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Dispose&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Dispose&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
It&#39;s that easy. The crazy thing is, it will take me longer to scan all the papers than it will to have them sorted!
&lt;br /&gt;
&lt;h4&gt;PowerShell module&lt;/h4&gt;
&lt;p&gt;I have put together a PowerShell module to make OCR in your scripts even easier:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Import-Module&lt;/span&gt; tesseractlib&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;psm1
&lt;span class=&quot;token variable&quot;&gt;$ocr&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-TessTextFromImage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token string&quot;&gt;&quot;C:&#92;Temp&#92;test.jpg&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$ocr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Confidence
&lt;span class=&quot;token variable&quot;&gt;$ocr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Text&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
You can pass in either a ```[System.Drawing.Image]``` object or a string path to the image. A more advanced example could look like the following:
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Import-Module&lt;/span&gt; tesseractlib&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;psm1
&lt;span class=&quot;token variable&quot;&gt;$files&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-ChildItem&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;jpg &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Get-TessTextFromImage&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$files&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Format-list&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The module can be found in my [GitHub repo](https://github.com/jourdant/powershell-paperless/blob/master/tesseractlib.psm1).
&lt;br /&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;It&#39;s really easy to read text from images in PowerShell.&lt;/p&gt;
&lt;p&gt;If you are looking to add OCR to your WinRT app, I would recommend checking &lt;a href=&quot;http://irisclasson.com/2014/09/30/video-get-started-with-optical-character-recognition-with-the-ocr-for-windows-runtime/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;this post&lt;/a&gt; from Iris Classon. There&#39;s even a video to go with it!&lt;/p&gt;
&lt;p&gt;I have to go now, my giant stack of paper awaits. Another post will follow with my progress using this module.&lt;/p&gt;
&lt;br /&gt;
Jourdan</description>
</item>
<item>
<title>Re-writing MyNetFone destination SIP headers</title>
<link>https://blog.jourdant.me/post/freeswitch-rewriting-mynetfone-sip-headers-to-show-correct-destination</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/freeswitch-rewriting-mynetfone-sip-headers-to-show-correct-destination</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>FreeSWITCH</category>
<pubDate>Thu, 11 Dec 2014 12:11:59 +0000</pubDate>
<description>&lt;p&gt;Internal numbering, or internal extensions are common practice among SIP providers for having multiple DID numbers on a single SIP registration.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mynetfone.com.au/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;MyNetFone&lt;/a&gt; is a good example. You register to MyNetFone using your assigned internal extension, eg, 0946xxxx. In my case, I have two regional DID numbers assigned to my account.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;problem&quot;&gt;Problem&lt;/h3&gt;
&lt;p&gt;Inbound calls to these regional numbers show the following in the SIP INVITE packet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;To: &amp;lt;sip:0946xxxx@sip01.mynetfone.com.au&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How can I find which number was dialled and re-write the &lt;strong&gt;To:&lt;/strong&gt; header? I want FreeSWITCH to route these calls through the same rules as my numbers from other providers. I want to route these numbers to different destinations if required.
&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
&lt;p&gt;After some investigation I discovered MyNetFone places the &amp;quot;dialled&amp;quot; number in the &lt;strong&gt;Diversion:&lt;/strong&gt; header shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Diversion: &amp;lt;sip:6186102xxxx@xxx.xxx.xxx.xxx&amp;gt;;reason=unconditional
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As mentioned, I have multiple numbers routing through a common set of dialplan rules; requiring me to normalise (&lt;a href=&quot;http://en.wikipedia.org/wiki/E.164&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;E.164&lt;/a&gt;) all incoming calls. This structure makes it very easy to re-write the header.&lt;/p&gt;
&lt;p&gt;The first XML dialplan in my public SIP profile is &amp;quot;00_normalisation.xml&amp;quot;. An excerpt is shown below that re-writes the Diversion header:&lt;/p&gt;
&lt;pre class=&quot;language-markup&quot;&gt;&lt;code class=&quot;language-markup&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;include&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;extension&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mynetfone_normalisation&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;true&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;condition&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;destination_number&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;expression&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;0946xxxx&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;require-nested&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;true&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;on-false&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;condition&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;${sip_h_Diversion}&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;expression&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;^(?:&amp;lt;sip:)?(&#92;d+)(?:@.+)?$&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
				&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;action&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;set&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;sip_h_Diversion=null&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
				&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;action&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;transfer&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;$1 XML public&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
			&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;condition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;condition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;extension&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	...
    
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;include&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note: Place this rule at the top of the file for normalisation to occur after the transfer.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Also for anyone interested, I have included my SIP provider configuration I use for MyNetFone; it&#39;s nice and simple:&lt;/p&gt;
&lt;pre class=&quot;language-markup&quot;&gt;&lt;code class=&quot;language-markup&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;include&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;gateway&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;MyNetFone&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;param&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;username&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;0946xxxx&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;param&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;password&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;xxxxxxxxxxxxxxxxxxx&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;param&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;realm&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;sip01.mynetfone.com.au&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;param&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;proxy&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;sip01.mynetfone.com.au&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;param&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;register&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;true&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
		&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;param&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;expire-seconds&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;120&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;gateway&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;include&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Part 2 - Scaling App-V content distribution using Azure CDN</title>
<link>https://blog.jourdant.me/post/scaling-app-v-content-distribution-using-azure-cdn</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/scaling-app-v-content-distribution-using-azure-cdn</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>App-V</category>
<pubDate>Wed, 26 Nov 2014 23:38:25 +0000</pubDate>
<description>&lt;p&gt;This is the final post in a two post series explaining how to utilise &lt;a href=&quot;https://www.azure.com/&quot;&gt;Microsoft Azure&lt;/a&gt; to serve &lt;a href=&quot;https://technet.microsoft.com/en-nz/library/jj713418.aspx&quot;&gt;Microsoft App-V 5.0&lt;/a&gt; content.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/serving-app-v-content-using-azure-blob-storage&quot;&gt;App-V + Azure [Part 1]: Serving App-V content using Azure Blob Storage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/scaling-app-v-content-distribution-using-azure-cdn&quot;&gt;App-V + Azure [Part 2]: Scaling App-V content distribution using Azure CDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;design&quot;&gt;Design&lt;/h3&gt;
&lt;p&gt;For this scenario, we are building on the design from &lt;a href=&quot;https://blog.jourdant.me/serving-app-v-content-using-azure-blob-storage&quot;&gt;Part 1&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/appvazuredesigncdn.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;The changes include adding an &lt;a href=&quot;https://azure.microsoft.com/en-us/services/cdn/&quot;&gt;Azure CDN&lt;/a&gt; in front of the &lt;a href=&quot;https://azure.microsoft.com/en-us/documentation/services/storage/&quot;&gt;Azure Blob Storage&lt;/a&gt;. This will allow clients distributed globally to get their App-V content from the [geographically] closest location. The goal is to create a faster, smoother experience for all users in all locations.&lt;/p&gt;
&lt;h3 id=&quot;pre-requisites&quot;&gt;Pre-requisites&lt;/h3&gt;
&lt;p&gt;If you are following along with the steps in this blog post, I recommend running through the steps in the &lt;a href=&quot;https://blog.jourdant.me/serving-app-v-content-using-azure-blob-storage&quot;&gt;first part of this series&lt;/a&gt;. You will need an Azure Blob Storage account and container set up to publish with the CDN.&lt;/p&gt;
&lt;h3 id=&quot;steps&quot;&gt;Steps&lt;/h3&gt;
&lt;h4&gt;1. Create Azure CDN Endpoint&lt;/h4&gt;
&lt;p&gt;In the Azure Portal, create a new CDN Endpoint. Select the URL of the Storage Account we created in &lt;a href=&quot;https://blog.jourdant.me/serving-app-v-content-using-azure-blob-storage&quot;&gt;Part 1&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurecdn-create.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Note: The endpoint shows up straight away in the Azure Portal. The publishing takes around 15 min to be fully set up however.&lt;/strong&gt;
&lt;br /&gt;&lt;/p&gt;
&lt;h4&gt;2. Test URLs&lt;/h4&gt;
&lt;p&gt;The CDN base URL can be found on the main screen of your CDN endpoint.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurecdn-endpoint.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;This URL is equivalent to the base URL of your Storage Account. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Storage Account URL: 
  http://appvexample.blob.core.windows.net/content/AppV5_7-zip_9.20_x64.appv
  
CDN URL:
  http://az694903.vo.msecnd.net/content/AppV5_7-zip_9.20_x64.appv
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h4&gt;3. Add custom domain &lt;em&gt;(optional)&lt;/em&gt;&lt;/h4&gt;
&lt;p&gt;We can make this URL look a lot nicer by adding a custom domain, eg, &lt;a href=&quot;https://blog.jourdant.me/post/appvcdn.jourdant.me&quot;&gt;http://appvcdn.jourdant.me&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Create a CNAME DNS record from your chosen domain name pointing at your CDN endpoint domain name.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurecdn-dns.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;In the settings for your CDN Endpoint, click Manage Domains and add the new domain to the list.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurecdn-customdomain.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Note: It will take another 15 min for these settings to be replicated out globally.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Custom domains can be used as the base URL. The after waiting for the replication you can use the following PowerShell command to test your CDN.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Add-AppVClientPackage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token string&quot;&gt;&quot;http://appvcdn.jourdant.me/content/AppV5_7-zip_9.20_x64.appv&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Publish-AppVClientPackage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Global&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Microsoft App-V 5.0 makes it really easy to scale the delivery of applications globally. Using Microsoft Azure or similar storage and CDN services, you can create a smooth experience for your users globally.&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Part 1 - Serving App-V content using Azure Blob Storage</title>
<link>https://blog.jourdant.me/post/serving-app-v-content-using-azure-blob-storage</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/serving-app-v-content-using-azure-blob-storage</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>App-V</category>
<pubDate>Mon, 17 Nov 2014 03:41:11 +0000</pubDate>
<description>&lt;p&gt;This two post series will explain how to utilise various &lt;a href=&quot;https://www.azure.com/&quot;&gt;Microsoft Azure&lt;/a&gt; services to distribute your &lt;a href=&quot;https://technet.microsoft.com/en-nz/library/jj713418.aspx&quot;&gt;Microsoft App-V 5.0&lt;/a&gt; content to a wide audience externally.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/serving-app-v-content-using-azure-blob-storage&quot;&gt;App-V + Azure [Part 1]: Serving App-V content using Azure Blob Storage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/scaling-app-v-content-distribution-using-azure-cdn&quot;&gt;App-V + Azure [Part 2]: Scaling App-V content distribution using Azure CDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;design&quot;&gt;Design&lt;/h3&gt;
&lt;p&gt;In our topology, we will assume that App-V users are off-premise.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/appvazuredesign.png&quot; alt=&quot;App-V + Azure Design&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;The App-V publishing server will be published via reverse proxy to the web on  domain &lt;strong&gt;appv.domain.com&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;steps&quot;&gt;Steps&lt;/h3&gt;
&lt;h4&gt;1. Create Azure Storage account and container&lt;/h4&gt;
&lt;p&gt;In the Azure Portal, create a Storage Account. Choose a URL, datacentre and type of data replication (for a good explanation on the differences in data replication, see &lt;a href=&quot;https://blogs.msdn.com/b/windowsazurestorage/archive/2013/12/04/introducing-read-access-geo-replicated-storage-ra-grs-for-windows-azure-storage.aspx&quot;&gt;this post&lt;/a&gt;)&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurestorage-create.png&quot; alt=&quot;Storage Account Creation&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Next, create a container to host the content inside.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurestorage-containercreate.png&quot; alt=&quot;Create a container&quot; /&gt;&lt;/figure&gt;
&lt;h4&gt;2. Move a sample package into Azure Storage Container&lt;/h4&gt;
&lt;p&gt;Using the storage account access keys, upload your .appv files to the container.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurestorage-addblob.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Optional: In the container, set the .appv files to the MIME type &amp;quot;application/appv&amp;quot; or &amp;quot;application/x-compressed&amp;quot;. Both are acceptable to the App-V Client.&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;3. Test the package in the App-V Client&lt;/h4&gt;
&lt;p&gt;Open an administrator PowerShell prompt and try the following:&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Add-AppVClientPackage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token string&quot;&gt;&quot;https://appvexample.blob.core.windows.net/content/AppV5_7-zip_9.20_x64.appv&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Publish-AppVClientPackage&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Global&lt;/code&gt;&lt;/pre&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurestorage-psaddpackage.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;If your output matches above, you should now see 7-Zip published to your machine.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurestorage-7zip.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;h4&gt;4. Add the package to the App-V Management Console&lt;/h4&gt;
&lt;p&gt;Copy the full URL to the package into the App-V Management Console and assign rights as necessary.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/azurestorage-console.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Note: The server hosting the App-V Management Console needs to have access through the firewall to your storage domain. (appvexample.blob.core.windows.net)&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;HTTP streaming with App-V allows you to separate your App-V publishing from your content. It allows you to be smarter with how that infrastructure is designed. The next post will demonstrate how to scale this further using the Azure CDN Service.&lt;/p&gt;
&lt;p&gt;If you&#39;re looking to co-locate your content publishing and App-V Publishing Server components, check out &lt;a href=&quot;http://virtualvibes.co.uk/ssl-and-https-with-app-v-5-0/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;this great post&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Publishing App-V 5.0 content with a wildcard SSL certificate</title>
<link>https://blog.jourdant.me/post/app-v-publishing-app-v-5-content-with-a-wildcard-ssl-certificate</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/app-v-publishing-app-v-5-content-with-a-wildcard-ssl-certificate</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>App-V</category>
<pubDate>Thu, 13 Nov 2014 21:24:00 +0000</pubDate>
<description>&lt;p&gt;I encountered an issue when trying to load balance and publish the App-V 5.0 web services behind an F5 hardware appliance. The design and fix below will also apply to other methods of load balancing and publishing if a wildcard certificate is involved.&lt;/p&gt;
&lt;h3 id=&quot;design&quot;&gt;Design&lt;/h3&gt;
&lt;p&gt;The App-V content is stored on a redundant file share published by an IIS Virtual Directory.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/layout.png&quot; alt=&quot;network layout&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&#92;&#92;san.internal&#92;appv5&#92;AppV5_7-zip_9.20_x64&#92;AppV5_7-zip_9.20_x64.appv -&amp;gt;
https: //srv-appv-1.internal/applications/AppV5_7-zip_9.20_x64/AppV5_7-zip_9.20_x64.appv
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Published as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;https: //appv.domain.com/Applications/AppV5_7-zip_9.20_x64/AppV5_7-zip_9.20_x64.appv
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Internally, the servers are using certificates signed by the internal CA. Externally, the F5 load balancer is publishing the servers with a wildcard &lt;em&gt;(*.domain.com)&lt;/em&gt; certificate.&lt;/p&gt;
&lt;h3 id=&quot;problem&quot;&gt;Problem&lt;/h3&gt;
&lt;p&gt;When browsing to the internal servers directly, everything worked great. Trying to add packages to the Management Console using the external URL however,  became a problem.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/broken2.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Digging in the event log showed a &amp;quot;Content Decoding Failed&amp;quot; error. After checking with a few people at Microsoft, this error seems to be related to certificate problems. Specifically if using a wildcard certificate. Turns out the Management Console doesn&#39;t like importing packages from a webserver published with a wildcard certificate.&lt;/p&gt;
&lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
&lt;p&gt;The solution is simple! Adding a single line to the hosts file of each App-V 5.0 Publishing Server solves the problem.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;127.0.0.1    appv.domain.com
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note: Don&#39;t forget to add the external domain name as a SAN to the certificate or this method will not work.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When the Management Service connects to the URL to verify the files, it will connect to itself rather than the load-balancer; using the internally signed (non-wildcard) certificate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bonus: The App-V 5.0 client (and PowerShell cmdlets) work perfectly fine with the wildcard cert and load-balanced configuration.&lt;/strong&gt;&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Getting scripty with Azure Mobile Services</title>
<link>https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>Azure</category>
<pubDate>Sat, 02 Aug 2014 22:32:00 +0000</pubDate>
<description>&lt;p&gt;In my opinion, &lt;a href=&quot;http://azure.microsoft.com/en-us/documentation/services/mobile-services/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Azure Mobile Services&lt;/a&gt; is not talked about nearly enough. In many of the projects I have worked on, the ability to create a REST API within minutes and consume it within my scripts is incredibly useful.&lt;/p&gt;
&lt;p&gt;For this post I am going to assume you have a basic knowledge of Azure Mobile Services - enough to create a service, table and define two columns. If you need some help, &lt;a href=&quot;http://azure.microsoft.com/en-us/documentation/articles/mobile-services-html-get-started/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;click here to get started&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By the end of this post you should have some insight on how to easily &#39;cloud enable&#39; an existing script. I will try to keep it as simple as I can without using external libraries where possible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Our scenario will be a simple app that reports the language runtime and version to an Azure Mobile Service.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;setup&quot;&gt;&lt;a name=&quot;setup&quot;&gt;&lt;/a&gt;Setup&lt;/h3&gt;
&lt;p&gt;A basic table will need to be created in your Mobile Service. We want to allow anyone with the application key to be able to insert. We&#39;ll allow anyone to retrieve this data.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2014-10-27-at-12-06-34-pm.png&quot; alt=&quot;Table configuration&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Create two columns both of String type called &#39;name&#39; and &#39;version&#39; respectively.&lt;/p&gt;
&lt;h3 id=&quot;index&quot;&gt;&lt;a name=&quot;index&quot;&gt;&lt;/a&gt;Index&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#bash&quot;&gt;Bash&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#powershell&quot;&gt;PowerShell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#python&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#vbscript&quot;&gt;VBScript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a name=&quot;bash&quot;&gt;&lt;/a&gt;Bash&lt;/h4&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#Set up service URL, token and data&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;https://kiwiot.azure-mobile.net/tables/runtime_versions&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;application_key&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;jpZgynEqcTHISISAFAKEKEYWwhOxeo21&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;runtime_name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Bash&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;runtime_version&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token environment constant&quot;&gt;$BASH_VERSION&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;post_data&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;name=&lt;span class=&quot;token variable&quot;&gt;${runtime_name}&lt;/span&gt;&amp;amp;version=&lt;span class=&quot;token variable&quot;&gt;${runtime_version}&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;post_headers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;X-ZUMO-APPLICATION:&lt;span class=&quot;token variable&quot;&gt;${application_key}&lt;/span&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#POST data to Azure&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-X&lt;/span&gt; POST &lt;span class=&quot;token parameter variable&quot;&gt;--data&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$post_data&lt;/span&gt;  &lt;span class=&quot;token parameter variable&quot;&gt;--header&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$post_headers&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#index&quot;&gt;Back to Index ⇧&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;powershell&quot;&gt;&lt;/a&gt;PowerShell&lt;/h4&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#Allow us to URL encode our data&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Add-Type&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;AssemblyName System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Web

&lt;span class=&quot;token comment&quot;&gt;#Set up service URL, token and data&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;https://kiwiot.azure-mobile.net/tables/runtime_versions&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$application_key&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;jpZgynEqcTHISISAFAKEKEYWwhOxeo21&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$runtime_name&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.Web.HttpUtility]&lt;/span&gt;::UrlEncode&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;PowerShell&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$runtime_version&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.Web.HttpUtility]&lt;/span&gt;::UrlEncode&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$PSVersionTable&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BuildVersion&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$post_data&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;name=&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$runtime_name&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&amp;amp;version=&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$runtime_version&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$post_headers&lt;/span&gt; = @&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;X-ZUMO-APPLICATION&quot;&lt;/span&gt;=&lt;span class=&quot;token variable&quot;&gt;$application_key&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#POST data to Azure&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;Invoke-WebRequest&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$url&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Method POST &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Body &lt;span class=&quot;token variable&quot;&gt;$post_data&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Headers &lt;span class=&quot;token variable&quot;&gt;$post_headers&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#index&quot;&gt;Back to Index ⇧&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;python&quot;&gt;&lt;/a&gt;Python&lt;/h4&gt;
&lt;p&gt;For Python we will be referencing a library called &lt;a href=&quot;http://docs.python-requests.org/en/latest/user/quickstart/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;requests&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; requests
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; string
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; sys

&lt;span class=&quot;token comment&quot;&gt;#Set up service URL, token and data&lt;/span&gt;
url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://kiwiot.azure-mobile.net/tables/runtime_versions&quot;&lt;/span&gt;
application_key &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jpZgynEqcTHISISAFAKEKEYWwhOxeo21&quot;&lt;/span&gt;
runtime_name &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Python&quot;&lt;/span&gt;
runtime_version &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; string&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;split&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;sys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;version&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39; &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
post_data &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;name&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; runtime_name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;version&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; runtime_version&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
post_headers &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;X-ZUMO-APPLICATION&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; application_key&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#POST data to Azure&lt;/span&gt;
response &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; requests&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;post&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; data&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;post_data&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; headers&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;post_headers&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#index&quot;&gt;Back to Index ⇧&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;vbscript&quot;&gt;&lt;/a&gt;VBScript&lt;/h4&gt;
&lt;pre class=&quot;language-vbscript&quot;&gt;&lt;code class=&quot;language-vbscript&quot;&gt;&#39;Create a function to POST with
Function AzurePOST(sUrl, sData, sKey)
	set oHTTP = CreateObject(&quot;Microsoft.XMLHTTP&quot;)
	oHTTP.open &quot;POST&quot;, sUrl, false	
	oHTTP.setRequestHeader &quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;
	oHTTP.setRequestHeader &quot;Content-Length&quot;, Len(sData)
	oHTTP.setRequestHeader &quot;X-ZUMO-APPLICATION&quot;, sKey
	oHTTP.send sData
	HTTPPost = oHTTP.responseText
End Function

&#39;Set up service URL, token and data
url = &quot;https://kiwiot.azure-mobile.net/tables/runtime_versions&quot;
application_key = &quot;jpZgynEqcTHISISAFAKEKEYWwhOxeo21&quot;
runtime_name = &quot;VBScript&quot;
runtime_version = ScriptEngineMajorVersion &amp; &quot;.&quot; &amp; ScriptEngineMinorVersion 
post_data = &quot;name=&quot; &amp; runtime_name &amp; &quot;&amp;version=&quot; &amp; runtime_version

&#39;POST data to Azure
AzurePOST url, post_data, application_key&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.jourdant.me/post/azure-getting-scripty-with-azure-mobile-services#index&quot;&gt;Back to Index ⇧&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;It is straight forward enabling reporting/telemetry/storage of data from your scripts. Independent of platform! The next blog post will show how to consume this data.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2014-10-27-at-1-56-15-pm.png&quot; alt=&quot;Runtime views&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Comment below if there are other languages you would like to see here.&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
<item>
<title>Installing drivers from untrusted publishers</title>
<link>https://blog.jourdant.me/post/ps-installing-drivers-from-untrusted-publishers</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/ps-installing-drivers-from-untrusted-publishers</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>PowerShell</category>
<pubDate>Sun, 06 Jul 2014 10:00:27 +0000</pubDate>
<description>&lt;p&gt;When I&#39;m building an image (especially a hardware independent  image), the driver injection tends to be the hardest part - for obscure or old bits of hardware anyway.&lt;/p&gt;
&lt;p&gt;I had a recent encounter with an old &lt;a href=&quot;http://www.amazon.com/gp/product/B00450CRWK/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=B00450CRWK&amp;amp;linkCode=as2&amp;amp;tag=blogjourdantm-20&amp;amp;linkId=JF76GWRHNFB2465T&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ATI Radeon X300&lt;/a&gt; low profile graphics card. The image was to be built for Windows 8. The last drivers published were for Windows 7 and included in a &lt;a href=&quot;http://support.amd.com/en-us/download/desktop/legacy?product=Legacy1&amp;amp;os=Windows%207%20-%2064&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;legacy package&lt;/a&gt; from 2010!&lt;/p&gt;
&lt;p&gt;I count myself lucky they had WDDM drivers for Windows 7 64-bit.&lt;/p&gt;
&lt;h3 id=&quot;problem&quot;&gt;Problem&lt;/h3&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/install_hardware_dialog.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Refer to the dialog above. In this case, drivers were to be injected using &lt;a href=&quot;http://technet.microsoft.com/en-us/library/ff800798.aspx&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;pnputil.exe&lt;/a&gt;. During a sysprep&#39;d startup, any application that blocks execution with a dialog is frustrating. This was a major hurdle.&lt;/p&gt;
&lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
&lt;p&gt;After further investigation, I found that checking the &lt;em&gt;&#39;Always trust software from &#39;{vendor}&#39;&lt;/em&gt;  box actually imports a certificate into the &lt;strong&gt;Cert:&#92;LocalMachine&#92;TrustedPublisher&lt;/strong&gt; store. On opening certlm.msc, I observed the following:&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/trusted_publisher.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Pro tip: Export these certificates on a test machine. Programatically import the certificates before importing the drivers. Everything works perfectly!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The script is included below. It imports all certificates in C:&#92;Drivers&#92;Certificates and then imports all drivers in C:&#92;Drivers&#92; sub-directories.&lt;/p&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Title:     Install-Drivers.ps1&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Author:    Jourdan Templeton&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Email:     hello@jourdant.me&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Modified:  24/06/2014 11:49AM NZDT&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;

&lt;span class=&quot;token variable&quot;&gt;$base_dir&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;C:&#92;Drivers&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$log_file&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;C:&#92;Logs&#92;Install-Drivers.log&quot;&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Start-Transcript&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$log_file&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Append &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;NoClobber

&lt;span class=&quot;token function&quot;&gt;Write-Output&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;[*] Importing Trusted Publishers...&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$certificates&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-ChildItem&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$base_dir&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&#92;Certificates&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Filter&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;cer &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Recurse
&lt;span class=&quot;token keyword&quot;&gt;ForEach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$certificate&lt;/span&gt; in &lt;span class=&quot;token variable&quot;&gt;$certificates&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token variable&quot;&gt;$cert&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Import-Certificate&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;FilePath &lt;span class=&quot;token variable&quot;&gt;$certificate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FullName &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;CertStoreLocation Cert:&#92;LocalMachine&#92;TrustedPublisher
    &lt;span class=&quot;token function&quot;&gt;Write-Output&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$cert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Subject
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Write-Output&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;`r`n[*] Importing Drivers...&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$drivers&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;Get-ChildItem&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$base_dir&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Filter&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;inf &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Recurse
&lt;span class=&quot;token keyword&quot;&gt;ForEach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$driver&lt;/span&gt; in &lt;span class=&quot;token variable&quot;&gt;$drivers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token function&quot;&gt;Write-Host&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$driver&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FullName
	pnputil&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exe &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;i &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;a &lt;span class=&quot;token variable&quot;&gt;$driver&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FullName
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;Stop-Transcript&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Should read fairly easily - post below for help.&lt;/p&gt;
&lt;p&gt;Jourdan&lt;/p&gt;
</description>
</item>
<item>
<title>Setting the Windows 8 Account Picture from AD</title>
<link>https://blog.jourdant.me/post/ps-setting-windows-8-account-picture-from-ad</link>
<guid isPermaLink="true">https://blog.jourdant.me/post/ps-setting-windows-8-account-picture-from-ad</guid>
<dc:creator>Jourdan Templeton</dc:creator>
<category>PowerShell</category>
<pubDate>Fri, 13 Jun 2014 07:49:12 +0000</pubDate>
<description>&lt;p&gt;If you&#39;re reading this, my guess is that you&#39;re probably building an image. That image is based on Windows 8.x and it&#39;s on the cusp of perfection. However, there&#39;s one last tweak that has eluded you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setting the Account Picture for domain users based on their photo in Active Directory.&lt;/strong&gt;&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/account_picture_lockscreen.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;Every couple of months I&#39;d come back to this issue, hoping for a solution.&lt;/p&gt;
&lt;p&gt;Truth is: &lt;strong&gt;it can be done&lt;/strong&gt;. Caveat: &lt;strong&gt;it&#39;s not perfect&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;blog_post&quot;&gt;&lt;/span&gt;A couple of days ago, I stumbled across an awesome blog post (&lt;a href=&quot;http://www.parackattu.com/2014/04/windows-8-windows-81-set-account.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;referenced here&lt;/a&gt;) that provided some VB.NET code to implement this method.&lt;/p&gt;
&lt;p&gt;I prefer PowerShell over compiled code for tasks like this. So I re-wrote the VB.NET code as a PowerShell script.&lt;/p&gt;
&lt;p&gt;Now, as I mentioned above, there is a catch with this solution: &lt;strong&gt;the user must log off and on again&lt;/strong&gt; for the updated picture to be shown in Windows.&lt;/p&gt;
&lt;p&gt;In a VDI scenario with non-persistent disks, unfortunately this solution is not for you. For others who predominantly use a single pc, this script will change your life!&lt;/p&gt;
&lt;p&gt;It basically takes the image out of Active Directory and stores it on the local machine in a hidden folder, then sets the location for Windows to use in the registry.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before this script will work&lt;/strong&gt;, Full Control permissions must be given to:  &lt;code&gt;HKLM&#92;SOFTWARE&#92;Microsoft&#92;Windows&#92;CurrentVersion&#92;AccountPicture&#92;Users&lt;/code&gt; and all descendants. This change can be rolled out in your base GPO for all machines. For those who need detailed instructions, please refer to the blog post referenced above. &lt;a href=&quot;https://blog.jourdant.me/post/ps-setting-windows-8-account-picture-from-ad#blog_post&quot;&gt;&lt;i class=&quot;fa fa-arrow-up&quot;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;The script can be downloaded &lt;u&gt;&lt;a href=&quot;http://goo.gl/YlAFJ0&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;here&lt;/a&gt;&lt;/u&gt;.&lt;/h4&gt;
&lt;pre class=&quot;language-powershell&quot;&gt;&lt;code class=&quot;language-powershell&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Title:	Set-AccountPictureFromAD.ps1&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Author:	Jourdan Templeton&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Email:	hello@jourdant.me&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Modified:	12/06/2014 3:27PM NZDT&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;

&lt;span class=&quot;token namespace&quot;&gt;[CmdletBinding(SupportsShouldProcess=$true)]&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Param&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Test-Null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$InputObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[bool]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$InputObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#get sid and photo for current user&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$user&lt;/span&gt; = &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[ADSISearcher]&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;(&amp;amp;(objectCategory=User)(SAMAccountName=&lt;span class=&quot;token variable&quot;&gt;$env&lt;/span&gt;:username))&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FindOne&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Properties
&lt;span class=&quot;token variable&quot;&gt;$user_photo&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;thumbnailphoto
&lt;span class=&quot;token variable&quot;&gt;$user_sid&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.Security.Principal.WindowsIdentity]&lt;/span&gt;::GetCurrent&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;User&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Value
&lt;span class=&quot;token function&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Updating account picture for &lt;span class=&quot;token function&quot;&gt;$&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;displayname&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;...&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;#continue if an image was returned&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Test-Null&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$user_photo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;$false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token function&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Success. Photo exists in Active Directory.&quot;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;#set up image sizes and base path&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$image_sizes&lt;/span&gt; = @&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;40&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 96&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 200&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 240&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 448&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$image_mask&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;Image{0}.jpg&quot;&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$image_base&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$env&lt;/span&gt;:public &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&#92;AccountPictures&quot;&lt;/span&gt;

	&lt;span class=&quot;token comment&quot;&gt;#set up registry&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$reg_base&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;HKLM:&#92;SOFTWARE&#92;Microsoft&#92;Windows&#92;CurrentVersion&#92;AccountPicture&#92;Users&#92;{0}&quot;&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$reg_key&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;::format&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$reg_base&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$user_sid&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token variable&quot;&gt;$reg_value_mask&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;Image{0}&quot;&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Test-Path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$reg_key&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;$false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;New-Item&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$reg_key&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; 
	
	&lt;span class=&quot;token comment&quot;&gt;#save images, set reg keys&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;ForEach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$size&lt;/span&gt; in &lt;span class=&quot;token variable&quot;&gt;$image_sizes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;token comment&quot;&gt;#create hidden directory, if it doesn&#39;t exist&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$dir&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$image_base&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&#92;&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$user_sid&lt;/span&gt;
		&lt;span class=&quot;token keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Test-Path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$dir&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;$false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; $&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;mkdir &lt;span class=&quot;token variable&quot;&gt;$dir&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Attributes = &lt;span class=&quot;token string&quot;&gt;&quot;Hidden&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

		&lt;span class=&quot;token comment&quot;&gt;#save photo to disk, overwrite existing files&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt; = &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;::format&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$image_mask&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$path&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$dir&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&#92;&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;  saving: &lt;span class=&quot;token variable&quot;&gt;$file_name&lt;/span&gt;&quot;&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$user_photo&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Set-Content&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Encoding Byte &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Force
		
		&lt;span class=&quot;token comment&quot;&gt;#save the path in registry, overwrite existing entries&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[string]&lt;/span&gt;::format&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$reg_value_mask&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token variable&quot;&gt;$value&lt;/span&gt; = &lt;span class=&quot;token function&quot;&gt;New-ItemProperty&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Path &lt;span class=&quot;token variable&quot;&gt;$reg_key&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Name &lt;span class=&quot;token variable&quot;&gt;$name&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Value &lt;span class=&quot;token variable&quot;&gt;$path&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Force
	&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;token function&quot;&gt;Write-Verbose&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Done.&quot;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Write-Error&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;No photo found in Active Directory for &lt;span class=&quot;token variable&quot;&gt;$env&lt;/span&gt;:username&quot;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Often, it&#39;s the small changes that make a big difference for users.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2014-06-12-at-2-58-00-pm.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;To test the script you can run it with the -Verbose PowerShell flag to see what&#39;s happening.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;https://blog.jourdant.me/img/post/Screen-Shot-2014-06-13-at-9-28-58-pm.png&quot; alt=&quot;&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;I leave you with a caution. The general reaction from our users after implementing this script is one of shock and surprise. Either they&#39;re happy with their photo and all is well, or they hate it and will do anything to get rid of it! ;)&lt;/p&gt;
&lt;p&gt;Here&#39;s another post I found helpful (&lt;a href=&quot;http://msitpros.com/?p=1036&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;referenced here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Feel free to post your questions and comments below.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[UPDATE 18/07/2014]:&lt;/strong&gt; Test-Null function fixed&lt;/p&gt;
&lt;br /&gt;
Jourdan
</description>
</item>
</channel>
</rss>
