<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Blog of Matthew Sojourner Newton]]></title><description><![CDATA[IT Consultant, &c.]]></description><link>https://blog.mnewton.com</link><generator>GatsbyJS</generator><lastBuildDate>Fri, 11 Oct 2024 04:02:43 GMT</lastBuildDate><item><title><![CDATA[Add SugarSS To Gatsby]]></title><description><![CDATA[It took me a while to figure out how to integrate SugarSS into the Gatsby build pipeline. I couldn’t find an example of anyone else doing it…]]></description><link>https://blog.mnewton.com/add-sugarss-to-gatsby/</link><guid isPermaLink="false">https://blog.mnewton.com/add-sugarss-to-gatsby/</guid><pubDate>Tue, 02 Apr 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 1000px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/5f5593ea7fbea77cb5d9e84d206cf500/f02b9/gatsby-sugarss.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 69.19999999999999%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAABzklEQVR42nWUzW7TQBDH/YqIl0HqhTdAvSKeAQkkLnColIRLD634OBbohxLFIRF1bO/37p+Z2dhxXDfSX7uenfnN7HicIjggeCBFWt1R3gaQCe77OepPL/Hv4wvY6zcI4heRAhBd1jCuiARrG4XlcoUYE8EDUkpgmlYWv3/dYL1ewXuL6CmCjppaoSzX5B/J7iUmUoJgGeg40OD+4R7b7RbVvoL8CKjIXpYlXK0RtIO1GahajdVqic1mg6qqYIzON2RgLjWJvKWMsmaJ3Sd83t3hy/YO7mD3vX8axKZ8ZdnYQw8s+gMOBl1jvlvi1Z+veH17iQXt4fNZ3zd7jGMVRnmoxvbSrYM3+ZCB68c93v1c4O2PGR7+7uBUQFsbOB1HLzGBWQXTJ6GSMbdz9uEKs/fX4Aa29dHPmnACzT08XHcK6kwU4Lf5La4ubmQ/BApUn0J74BNonaGBBq+uFD03NHtBkgyBJ1A7Ak5Vao2nGUsHZZ8pKNukwnHJHZQbr5UjaQpQshp6zmOCZysteMOAMVS3XKmhr0ijJp+q0pKkA7IYMIYWnKkrdzwGbPd8Xu9FQ1inLr5TMXY4jkCSP42oW+znZ2gWZ7Jn2xS4e8v/AVzHPjfNDMS7AAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/5f5593ea7fbea77cb5d9e84d206cf500/1e0be/gatsby-sugarss.webp 250w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/b0a15/gatsby-sugarss.webp 500w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/a5d4d/gatsby-sugarss.webp 1000w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/293e0/gatsby-sugarss.webp 1500w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/a3594/gatsby-sugarss.webp 1554w&quot;
              sizes=&quot;(max-width: 1000px) 100vw, 1000px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/5f5593ea7fbea77cb5d9e84d206cf500/63868/gatsby-sugarss.png 250w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/0b533/gatsby-sugarss.png 500w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/00d43/gatsby-sugarss.png 1000w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/aa440/gatsby-sugarss.png 1500w,
/static/5f5593ea7fbea77cb5d9e84d206cf500/f02b9/gatsby-sugarss.png 1554w&quot;
            sizes=&quot;(max-width: 1000px) 100vw, 1000px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/5f5593ea7fbea77cb5d9e84d206cf500/00d43/gatsby-sugarss.png&quot;
            alt=&quot;Sugarss Diving into the Gatsby Pipeline&quot;
            title=&quot;Sugarss Diving into the Gatsby Pipeline&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It took me a while to figure out how to integrate &lt;a href=&quot;https://github.com/postcss/sugarss&quot; title=&quot;SugarSS&quot;&gt;SugarSS&lt;/a&gt; into the &lt;a href=&quot;https://www.gatsbyjs.org/&quot; title=&quot;Gatsby&quot;&gt;Gatsby&lt;/a&gt; build pipeline. I couldn’t find an example of anyone else doing it online. So, I decided to quickly write this up.&lt;/p&gt;
&lt;h2&gt;Install dependencies&lt;/h2&gt;
&lt;p&gt;First, install the appropriate node modules.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&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;npm&lt;/span&gt; i gatsby-plugin-postcss postcss-preset-env sugarss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Add to the Gatsby configuration&lt;/h2&gt;
&lt;p&gt;Next, add the module to the Gatsby configuration by adding it to the &lt;code class=&quot;language-text&quot;&gt;plugins&lt;/code&gt; array.&lt;/p&gt;
&lt;h3&gt;&lt;code class=&quot;language-text&quot;&gt;gatsby-config.js&lt;/code&gt;&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exports &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 literal-property property&quot;&gt;plugins&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 template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;gatsby-plugin-postcss&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&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;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Add the Webpack configuration&lt;/h2&gt;
&lt;p&gt;Since Gatsby has its own byzantine Webpack setup, we can’t just write our own. Thankfully, Gatsby provides a hook to modify the Webpack configuration. Even that, though, is complicated and I frankly have no idea how to debug it. I got this working by piecing together a couple parts of the documentation and a little trial and error.&lt;/p&gt;
&lt;p&gt;Here is the whole incantation.&lt;/p&gt;
&lt;h3&gt;&lt;code class=&quot;language-text&quot;&gt;gatsby-node.js&lt;/code&gt;&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; postCssPlugins &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 function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;postcss-modules-values&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&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;

exports&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onCreateWebpackConfig&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 parameter&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; actions&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; stage&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; loaders &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; cssLoaderOptions &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 punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; postCssLoaderOptions &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 punctuation&quot;&gt;}&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 operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; setWebpackConfig &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; actions&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; isSSR &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; stage&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&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;const&lt;/span&gt; sssRule &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 literal-property property&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\.sss$&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token literal-property property&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; isSSR
      &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&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 punctuation&quot;&gt;]&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;
          loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;miniCssExtract&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;
          loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;css&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;cssLoaderOptions&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;importLoaders&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&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;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
          loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;postcss&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;postCssLoaderOptions&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token literal-property property&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; postCssPlugins&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;token literal-property property&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;sugarss&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&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;
  &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;const&lt;/span&gt; sssRuleModules &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 literal-property property&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token regex&quot;&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex-source language-regex&quot;&gt;\.module\.sss$&lt;/span&gt;&lt;span class=&quot;token regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token literal-property property&quot;&gt;use&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 operator&quot;&gt;!&lt;/span&gt;isSSR &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;miniCssExtract&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 literal-property property&quot;&gt;hmr&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&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;
      loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;css&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;cssLoaderOptions&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token literal-property property&quot;&gt;modules&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&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 literal-property property&quot;&gt;importLoaders&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&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;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
      loaders&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;postcss&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;postCssLoaderOptions&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token literal-property property&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; postCssPlugins&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token literal-property property&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;sugarss&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&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;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Boolean&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;let&lt;/span&gt; configRules &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 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;switch&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;stage&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;case&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;develop&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;build-javascript&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;build-html&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;develop-html&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;
      configRules &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; configRules&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;concat&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 literal-property property&quot;&gt;oneOf&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;sssRuleModules&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; sssRule&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;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;break&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;setWebpackConfig&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 literal-property property&quot;&gt;module&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 literal-property property&quot;&gt;rules&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; configRules
    &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;
&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;/div&gt;</content:encoded></item><item><title><![CDATA[Virtualbox and VMware Workstation bridged networking on Windows]]></title><description><![CDATA[I use VMware Workstation for most of my virtual machines on my Windows development machine. However, I also like to use vagrant to manage…]]></description><link>https://blog.mnewton.com/vmware-workstation-and-virtualbox/</link><guid isPermaLink="false">https://blog.mnewton.com/vmware-workstation-and-virtualbox/</guid><pubDate>Tue, 21 Jun 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I use VMware Workstation for most of my virtual machines on my Windows development machine. However, I also like to use &lt;a href=&quot;https://www.vagrantup.com/&quot;&gt;vagrant&lt;/a&gt; to manage development projects. While I could pay HashiCorp $80 to get vagrant to work with VMware Workstation, I don’t see the value. Vagrant works perfectly out of the box with VirtualBox.&lt;/p&gt;
&lt;h4&gt;So, VMware Workstation and VirtualBox need to cohabitate on the same machine&lt;/h4&gt;
&lt;p&gt;Mostly, they work fine together. But I found out the hard way that as soon as I installed VirtualBox, all of my VMware Workstation machines using bridged networking became disconnected. After some digging, I found the reason.&lt;/p&gt;
&lt;p&gt;VMware Workstation automatically chooses the adapter to use for bridged networking. Once VirtualBox is installed, it apparently chose the ‘VirtualBox Host-Only Ethernet Adapter.’ Once you know this, it’s easy to fix.&lt;/p&gt;
&lt;h2&gt;The fix&lt;/h2&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 702px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/11c1849dda11c5a990f93898be627acc/d6331/vmnet-editor.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 96%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAACXBIWXMAAAsTAAALEwEAmpwYAAACzElEQVR42q1U2U7bUBD1t1f9DZYKEKW89Q0QKUhB0FJFVQyJHa9xEttZnB2SIMTpnElvilAr9aGWjubanjmz3HOvZfsBut0e+v0+BoMBer2e2uFwiDiOcX9/r3AcR20URRs/g6Io1LdWq8FKm0202m2Mx2O0xU6nUwRhqIGROI1GIzw+PqKQBJ1OB0mSKEGW55jOZlJMF03h4L+h+FpZ2IQvwfzZaDSEYCwVFELeUfLVaoXV0xPmDw8aPJlMsJRvfamSa4JVjqQgwuKPtJNiuVxqmyRgRW8f/mdbJOCTpqn6Mymr5hjm8zmsyWSqDi8vLxv7N5jnra95SL4h/B+PEq6HvsCDzOhfsVgsdAQcDdfE8/MzWJzVlYFyA5JmIruV6JwMoug34ri5ges2VCKe58tGeqjX66oM7rxF/eWyILjmYNeYvVrPtR1uCOXFTfA8Tzem1WohCAJ9z7JMKhQpMIPrugglC50YQEdaAyYzhLQzkRmTaEIZAy3HZ3HrGcwMJORpYLsUKoVOSzAxpUGYrihoxnmi3yiMUIQtWOYYXZXL2N/fx8HBAY6OjnB8fIy9vT3s7Oxgd3cX29vbiq2tLf12eHio/h/E5/P7d7j+9BHFeLImZO/lqyuUvpRQFuLLy0vF+fk5SqUSLi4ucHZ2pjg9PcXJyQm+3tygUqkoqrff8P36GgM5ktZAyk+FsFb5gTxpI80znSOTsGWzHo6GMr/1DDkrzpCyURnJ6arL5dGTsWiFZHaqd/AdF1Xbhi2gLDhPWsepy7xivTDCMNBZr2UV6ZqJ6cfRqWwI+85Wayp4DX7L+3JhpDmyrpz9NNONIgE7YByVooSskAHMwGyUCHfvNfitEcSway58uZ0ckVi1Wt2ogpJjVyRWHTKb7/t6ff2J0AiXbfKiNX6MMZbklKDF/lVLv5RuToQBq1+3lqkGScAYBvM7rdEki/sJ6Fh23v+9FzYAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/11c1849dda11c5a990f93898be627acc/1e0be/vmnet-editor.webp 250w,
/static/11c1849dda11c5a990f93898be627acc/b0a15/vmnet-editor.webp 500w,
/static/11c1849dda11c5a990f93898be627acc/de2ca/vmnet-editor.webp 702w&quot;
              sizes=&quot;(max-width: 702px) 100vw, 702px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/11c1849dda11c5a990f93898be627acc/63868/vmnet-editor.png 250w,
/static/11c1849dda11c5a990f93898be627acc/0b533/vmnet-editor.png 500w,
/static/11c1849dda11c5a990f93898be627acc/d6331/vmnet-editor.png 702w&quot;
            sizes=&quot;(max-width: 702px) 100vw, 702px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/11c1849dda11c5a990f93898be627acc/d6331/vmnet-editor.png&quot;
            alt=&quot;Virtual Network Editor&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;From VMware Workstation choose &lt;code class=&quot;language-text&quot;&gt;Edit -&gt; Virtual Network Editor...&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;At the bottom of the dialog, click &lt;code class=&quot;language-text&quot;&gt;Change Settings&lt;/code&gt; to elevate to administrator credentials&lt;/li&gt;
&lt;li&gt;From the list at the top, choose the &lt;code class=&quot;language-text&quot;&gt;Bridged&lt;/code&gt; type virtual network&lt;/li&gt;
&lt;li&gt;Under &lt;code class=&quot;language-text&quot;&gt;VMnet Information -&gt; Bridged&lt;/code&gt; click &lt;code class=&quot;language-text&quot;&gt;Automatic Settings&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Uncheck &lt;code class=&quot;language-text&quot;&gt;VirtualBox Host-Only Ethernet Adapter&lt;/code&gt; and click OK, OK&lt;/li&gt;
&lt;/ol&gt;</content:encoded></item><item><title><![CDATA[Fun Password Generator]]></title><description><![CDATA[Here is a simple random password generator. It is intended to be used with a password manager, since no attempt has been made to make the…]]></description><link>https://blog.mnewton.com/fun-password-generator/</link><guid isPermaLink="false">https://blog.mnewton.com/fun-password-generator/</guid><pubDate>Wed, 08 Apr 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Here is a simple random password generator. It is intended to be used with a password manager, since no attempt has been made to make the passwords memorable by humans.&lt;/p&gt;
&lt;h2&gt;Where&lt;/h2&gt;
&lt;p&gt;The project is hosted at &lt;a href=&quot;&quot;&gt;https://github.com/mnewt/fpw&lt;/a&gt;. It’s also on PyPI at
&lt;a href=&quot;&quot;&gt;https://pypi.org/project/fpw/&lt;/a&gt; so it’s installable by running:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;pip install fpw&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Why&lt;/h2&gt;
&lt;p&gt;I made this because I couldn’t find a tool that fit all of my criteria:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;portable (run unmodified on OS X, Linux, and Windows)&lt;/li&gt;
&lt;li&gt;all options being equal, generates completely random passwords from the entire given set of characters&lt;/li&gt;
&lt;li&gt;uses a complete (semi) ASCII character set, including punctuation&lt;/li&gt;
&lt;li&gt;optionally uses a larger Unicode character set&lt;/li&gt;
&lt;li&gt;optionally uses character subsets (numbers, lowercase, uppercase, punctuation)&lt;/li&gt;
&lt;li&gt;optionally generates passwords containing &gt;= X number of a specified character subset, such as at least one lowercase, uppercase, number, and special character&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Password generators that did not fit the bill:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1Password - You have to specify how many numbers and special characters you want. You can’t have a random number from each character set. This is really poor and degrades the randomness of your passwords&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I want to mention &lt;a href=&quot;http://sourceforge.net/projects/pwgen/&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;pwgen&lt;/code&gt;&lt;/a&gt;. That is a really good program. You should use it instead of my stupid program.&lt;/p&gt;
&lt;p&gt;Here are all the options:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&gt; pw -h
usage: pw [-h] [--number NUMBER] [--pronounceable] [--lower]
          [--minimum-lower MINIMUM_LOWER] [--upper]
          [--minimum-upper MINIMUM_UPPER] [--digits]
          [--minimum-digits MINIMUM_DIGITS] [--special]
          [--minimum-special MINIMUM_SPECIAL] [--characters CHARACTERS]
          [--unicode]
          [length]

Generate random passwords

positional arguments:
  length                length of password

optional arguments:
  -h, --help            show this help message and exit
  --number NUMBER, -n NUMBER
                        number of passwords to generate
  --pronounceable, -p   Create human pronounceable passwords
  --lower, -l           Use lower case letters
  --minimum-lower MINIMUM_LOWER, -L MINIMUM_LOWER
                        minimum number of lowercase characters required
  --upper, -u           Use upper case letters
  --minimum-upper MINIMUM_UPPER, -U MINIMUM_UPPER
                        minimum number of upper characters required
  --digits, -d          Use digits
  --minimum-digits MINIMUM_DIGITS, -D MINIMUM_DIGITS
                        minimum number of digit characters required
  --special, -s         Use special characters (punctuation)
  --minimum-special MINIMUM_SPECIAL, -S MINIMUM_SPECIAL
                        minimum number of special characters required
  --characters CHARACTERS, -c CHARACTERS
                        Specify individual characters
  --unicode, -Z         Use a very large unicode character set full of
                        untypable characters&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Sample output&lt;/h2&gt;
&lt;p&gt;The default output is a completeley random, 16 character password&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&gt; pw
A\N[2~BM&quot;(Fq2I;u&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Make three passwords that meet Active Directory’s default requirements&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&gt; pw -L 1 -U 1 -D 1 -S 1 -n 3 8
n@0M|~.d
m+d$0i`B
!:y2#{Mu&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Make ten passwords with an &lt;code class=&quot;language-text&quot;&gt;INSANE&lt;/code&gt; Unicode character set that are guaranteed to be uncrackable:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&gt; pw -Z -n 5
ձể𝞎ｎὖῄꙘӲẌⱛСÉ𐐬ὰsḺ
𐐰Vὔֆ𝗯𝚉ѳ𝟉𝞲ӟմ𝛙𝗖Ⲭ𝜇ꝍ
𝐆𝖻𝑗𝑚𝜰γƬӓńȰꚇŷ𝘖𝛲ṏą
ɰъԄᾂⲁẅᴢ𝘑ⲻɏ𝓤Ⲍ𝔵𝗶ŇẶ
ΠăѠẈ𝔢άց𝜋ႿⲔƮⱉ𝕤Պ𝑬ᶊ&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This seems to meet all of my requirements, and appears to be pretty random. I would like to know how to improve it. I think it is random enough to be secure, but I’d love some confirmation from anyone in the know.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Citrix Marchitecture]]></title><description><![CDATA[I love Citrix and they make some great stuff. But let’s be honest. It’s no secret that some of their products are duct taped together and…]]></description><link>https://blog.mnewton.com/citrix-marchitecture/</link><guid isPermaLink="false">https://blog.mnewton.com/citrix-marchitecture/</guid><pubDate>Wed, 10 Apr 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I love Citrix and they make some great stuff. But let’s be honest. It’s no secret that some of their products are duct taped together and that their products’ names change at least as often as they are released. But right now I’m being forced to get my CCEE certification to meet a client’s requirements and I’m reminded just how bad it is.&lt;/p&gt;
&lt;p&gt;After years of working with Citrix, I’m pretty sure this is how the product development process goes:&lt;/p&gt;
&lt;p&gt;Exec to Engineer: What’s the minimum we need to do to squeak this new sexy feature out?&lt;/p&gt;
&lt;p&gt;Engineer: Well, it’s complicated, but I prepared a 64-point, statistically rigorous, peer-reviewed high level proposal which I will now present to you…&lt;/p&gt;
&lt;p&gt;Exec: That’s whatever you were talking about for you. I’ll give you 9.2% of that because I’m using the rest on our upcoming Six Sigma Yacht Polo retreat. You are not invited by the way.&lt;/p&gt;
&lt;p&gt;…later…&lt;/p&gt;
&lt;p&gt;Exec to Marketing: Engineering has sent me some long files that I can only guess have lots of long words in them. Take the chapter titles and make PowerPoints out of them. Whatever you do, don’t read past the chapter titles or you could end up just like those engineers!&lt;/p&gt;
&lt;p&gt;…later…&lt;/p&gt;
&lt;p&gt;Press Release: Citrix has just released an awesome product that is so revolutionary it’s never even heard of any other Citrix products!&lt;/p&gt;
&lt;p&gt;…back in Santa Clara…&lt;/p&gt;
&lt;p&gt;Engineer to Exec: That sounds great but you know we don’t make anything like that, right?&lt;/p&gt;
&lt;p&gt;Exec: Sure we do, you said so yourself in some document or whatever.&lt;/p&gt;
&lt;p&gt;Engineer: Did you read it?&lt;/p&gt;
&lt;p&gt;Exec: Read what?&lt;/p&gt;
&lt;p&gt;Engineer: The proposal, the report, the press release…&lt;/p&gt;
&lt;p&gt;Exec: I have people for that. You better ship that product that Marketing just announced!&lt;/p&gt;
&lt;p&gt;Engineer: But this press release doesn’t make any sense. At a quick read it sounds great, but upon closer inspection, it’s just not in any known language. All of these words are more or less technical terms, but it’s really just one malpropism glued to another. You can’t just re-invent existing technical terms to suit your marketing.&lt;/p&gt;
&lt;p&gt;Exec: Nonsense. People will read into it whatever they want, then money. You just have to rewrite the manual.&lt;/p&gt;
&lt;p&gt;…later…&lt;/p&gt;
&lt;p&gt;Engineer: I have written the admin manual equivalent of The Jabberwocky. The serpent has eaten its own tail. I just hope no one from Professional Services gets my number.&lt;/p&gt;
&lt;h2&gt;Which leads back to me and studying for my exam:&lt;/h2&gt;
&lt;p&gt;Citrix to me: Please study this copy of The Jabberwocky. You will be tested on your ability to assimilate and regurgitate its diction.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[nest Automatically Configures Network Settings]]></title><description><![CDATA[In my job as a consultant, I frequently connect my computer to different clients’ networks. What’s more, each client has their own network…]]></description><link>https://blog.mnewton.com/nest-automatically-configures-network-settings/</link><guid isPermaLink="false">https://blog.mnewton.com/nest-automatically-configures-network-settings/</guid><pubDate>Thu, 21 Mar 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;In my job as a consultant, I frequently connect my computer to different clients’ networks. What’s more, each client has their own network parameters, be they proxies, static IP settings, peculiar DNS settings, or the like. If that wasn’t enough, I need to stay connected to my office networks.&lt;/p&gt;
&lt;p&gt;Now, I don’t like repetitive tasks. That is what computers are for. I thought there must be a good software package that can handle all this for me.&lt;/p&gt;
&lt;p&gt;For a while I tried to like &lt;a href=&quot;http://www.controlplaneapp.com/&quot;&gt;ControlPlane&lt;/a&gt;. While it’s a great effort and I sincerely appreciate the application’s best intentions, it is not engineered very well. It frequently hangs because any time a script or other element has its execution blocked because it’s waiting on network I/O to respond, UI elements are blocked too.&lt;/p&gt;
&lt;p&gt;I decided there must be a simpler way. I searched around a bit and found &lt;a href=&quot;http://tech.inhelsinki.nl/locationchanger/&quot;&gt;LocationChanger&lt;/a&gt;, which is a great little script. The idea is awesome but it’s just not sophisticated enough for my needs.&lt;/p&gt;
&lt;p&gt;So, I took the idea behind LocationChanger and wrote my own script.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mnewt/nest&quot;&gt;nest&lt;/a&gt; is a command line utility that automatically configures your Mac when the network connection state changes.&lt;/p&gt;
&lt;h2&gt;When your Mac does things:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Connects to a network&lt;/li&gt;
&lt;li&gt;Resumes from sleep&lt;/li&gt;
&lt;li&gt;Disconnects from a network&lt;/li&gt;
&lt;li&gt;Starts up&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;nest responds by taking acton:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Sets the Network Location&lt;/li&gt;
&lt;li&gt;(Re)Connects to a VPN&lt;/li&gt;
&lt;li&gt;(Re)Connects to an SSH tunnel&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Make nest go by defining &lt;strong&gt;profiles&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;PROFILE&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Coffee Shop&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;LOCATION&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Public&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;VPN&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;myvpn&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;SSH&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;ssh -f -N -C -D 1080 user@example.com -L 8080/localhost/8080&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;MACADDR&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;0:11:22:33:44:55&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;SSID&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;AT&amp;amp;T&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Please have a look. I think you will find it flexible and fun to use, as long as you think shell scripts are fun.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mnewt/nest&quot;&gt;https://github.com/mnewt/nest&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Reporting Active Directory Logons in PowerShell]]></title><description><![CDATA[Reporting on AD Logons has always been much more difficult than it should be. Before Windows 2003, there was no central log of logons at all…]]></description><link>https://blog.mnewton.com/reporting-active-directory-logons-in-powershell/</link><guid isPermaLink="false">https://blog.mnewton.com/reporting-active-directory-logons-in-powershell/</guid><pubDate>Tue, 30 Oct 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Reporting on AD Logons has always been much more difficult than it should be. Before Windows 2003, there was no central log of logons at all. The &lt;code class=&quot;language-text&quot;&gt;lastLogon&lt;/code&gt; attribute on each user object would seem to do the trick; however, it only records the last logon time on the queried domain controller—it is not synchronized between DC’s. Even in Windows 2012, there the central logging attribute, &lt;code class=&quot;language-text&quot;&gt;lastLogonTimeStamp&lt;/code&gt;, is only completely replicated every 14 days.&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/fe42a380c722e8c12a446f29f533bba9/0b533/graph1.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 67.19999999999999%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAARlAAAEZQAGA43XUAAABvklEQVR42n1T227bMAz1///O3taXDduAYdjDgq5tCi9L07RJlLjxXdbVZyTjBmnmhgBBi6akc3ioxFqLGOOo932PqqqgNgpKKfkeqzm1xDmHHm+TrzaevWyJtUZuqrSFD+Hs9kN0PowgewehJYSURdHSgUPBq9edx8O2wTJrpTjGQ57rOxvQ0P9zJokxBj0dlDcW4XhgpA0et8sS06cSqtBHRLy9bB3SVQVtnKz7tz30ktzXFrvKSDGvW+MxUzUWu4a8xVw1kmOrtZO19fF/hF3XUSZivde4XuSYrSspaTqH2abGX/I5HZyuSiyIPlvRGNwRcku95VrjiH6rwWwHhCBaBvdEY513stbUo3RVY/pc4nv6gptlgYxYsL1Q/DbN4MIBYaQ2hUFQQcj9KUmUyXyPyUOOR6J4vSjwI83whxAzus83W/ya5/h6l+HjZCM5Vh/nKnt/QFhpj0+/tyREgQ8/V7iaKDySuizStjTHPn653eEp04PiI3MoCGNASz3blVpuZbfUijDMnHwTJWYiqjJFystUxHcQnqolo3bh5Vx6QYnWGvyejbFDNPA07BzdMVK+G9ZDZGYcec/pa/kHCSv07y7+CHoAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/fe42a380c722e8c12a446f29f533bba9/1e0be/graph1.webp 250w,
/static/fe42a380c722e8c12a446f29f533bba9/b0a15/graph1.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/fe42a380c722e8c12a446f29f533bba9/63868/graph1.png 250w,
/static/fe42a380c722e8c12a446f29f533bba9/0b533/graph1.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/fe42a380c722e8c12a446f29f533bba9/0b533/graph1.png&quot;
            alt=&quot;graph1&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Goal&lt;/h3&gt;
&lt;p&gt;So, if you want to find out who has logged today across the domain, or who has logged on in the last hour, you need to do some scripting work. The best tool to do that these days is PowerShell.&lt;/p&gt;
&lt;p&gt;This first script tallies all users who log on within a 24 hour period and creates two csv files: one with all the users’ names and a second called &lt;code class=&quot;language-text&quot;&gt;DailyReport.csv&lt;/code&gt;. Each day it creates a new line in the latter csv file. After a number of days, you can make a pretty picture like the ones here.&lt;/p&gt;
&lt;h4&gt;PSLoggedOnToday.ps1&lt;/h4&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;powershell&quot;&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;#!powershell.exe&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# ======================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# PSLoggedOnToday.ps1&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Logs a list of users who logged on during the current day&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Created by Matthew Newton&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# 10.17.2012&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Queries each Domain Controller in the current domain and compiles a&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# list of distinguishedName and lastLogon attributes for each user. Then&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# it outputs only those users who have logged on during the current day&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# (since midnight) as determined by the local computer.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# ======================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Heavily based on Richard L. Mueller&apos;s PSLastLogon.ps1.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Link: http://www.rlmueller.net/PowerShell/PSLastLogon.txt&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# And:  http://www.rlmueller.net/Last%20Logon.htm&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Richard&apos;s header is reproduced below:&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# ----------------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Copyright (c) 2011 Richard L. Mueller&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Hilltop Lab web site - http://www.rlmueller.net&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Version 1.0 - March 16, 2011&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# This program queries every Domain Controller in the domain to find the&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# largest (latest) value of the lastLogon attribute for each user. The&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# last logon dates for each user are converted into local time. The&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# times are adjusted for daylight savings time, as presently configured.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# You have a royalty-free right to use, modify, reproduce, and&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# distribute this script file in any way you find useful, provided that&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# you agree that the copyright owner above has no warranty, obligations,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# or liability for such use.&lt;/span&gt;


&lt;span class=&quot;token keyword&quot;&gt;Trap&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Error: &lt;span class=&quot;token variable&quot;&gt;$_&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;Break&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;$D&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.DirectoryServices.ActiveDirectory.Domain]&lt;/span&gt;::GetCurrentDomain&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;$Domain&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[ADSI]&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;LDAP://&lt;span class=&quot;token variable&quot;&gt;$D&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$Searcher&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;DirectoryServices&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DirectorySearcher
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;PageSize = 200
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SearchScope = &lt;span class=&quot;token string&quot;&gt;&quot;subtree&quot;&lt;/span&gt;

&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Filter&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;(&amp;amp;(objectCategory=person)(objectClass=user))&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;PropertiesToLoad&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Add&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;distinguishedName&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &gt; &lt;span class=&quot;token variable&quot;&gt;$Null&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;PropertiesToLoad&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Add&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;lastLogon&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &gt; &lt;span class=&quot;token variable&quot;&gt;$Null&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Create hash table of users and their last logon dates.&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$arrUsers&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;# Enumerate all Domain Controllers.&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;$DC&lt;/span&gt; In &lt;span class=&quot;token variable&quot;&gt;$D&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DomainControllers&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;$Server&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$DC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name
    &lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SearchRoot = &lt;span class=&quot;token string&quot;&gt;&quot;LDAP://&lt;span class=&quot;token variable&quot;&gt;$Server&lt;/span&gt;/&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$Domain&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;distinguishedName
    &lt;span class=&quot;token variable&quot;&gt;$Results&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FindAll&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;ForEach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Result&lt;/span&gt; In &lt;span class=&quot;token variable&quot;&gt;$Results&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;$DN&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Properties&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Item&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;distinguishedName&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token variable&quot;&gt;$LL&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Properties&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Item&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;lastLogon&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&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 variable&quot;&gt;$LL&lt;/span&gt;&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;$Last&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[DateTime]&lt;/span&gt;0
        &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 variable&quot;&gt;$Last&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[DateTime]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$LL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Item&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Last&lt;/span&gt; &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;$LastLogon&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Last&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AddYears&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1600&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;Else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token variable&quot;&gt;$LastLogon&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Last&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AddYears&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1600&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ToLocalTime&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$LastLogon&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-gt&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;[DateTime]&lt;/span&gt;::Today&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ContainsKey&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;$DN&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$LastLogon&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-gt&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&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;$DN&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 variable&quot;&gt;$arrUsers&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;$DN&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$LastLogon&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;Else&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Add&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;$DN&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$LastLogon&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;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Output file names&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$fileName&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 class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ToString&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;yyyy-MM-dd&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 string&quot;&gt;&quot;_&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;.csv&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$reportName&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;DailyReport.csv&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Output List of Users to CSV&lt;/span&gt;
&amp;amp;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;GetEnumerator&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;ForEach&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; PSObject &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Property @&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;DN = &lt;span class=&quot;token variable&quot;&gt;$_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; lastLogon = &lt;span class=&quot;token variable&quot;&gt;$_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value&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; &lt;span class=&quot;token function&quot;&gt;Export-CSV&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$fileName&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;NoType

&lt;span class=&quot;token comment&quot;&gt;# Append Total Count to CSV&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$totalRow&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;User Count: &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count
&lt;span class=&quot;token function&quot;&gt;Add-Content&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$fileName&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$totalRow&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Output Time and User Count to report CSV&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$reportRow&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&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 function&quot;&gt;Get-Date&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;ToString&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 string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;,&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count
&lt;span class=&quot;token function&quot;&gt;Add-Content&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$reportName&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$reportRow&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;Resulting report:&lt;/h4&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/8d0561ecd796b388ecb19986bcd88c3f/0b533/graph2.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 65.2%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAARlAAAEZQAGA43XUAAACOElEQVR42nWS2W8SURTG+dd8M1GfjU/GJTHamCh1SWMTE8Wn1rSBqCRicGlVaqVapRVqBSv1wQWqqJCmMo6yCi3T6exzZz4vw7DMqJP8cs/9zpkv595zPbquwzBNEMOEaboB2J8lFJkfdP2FcrkKQshfdYOfR5RkSIpOQwM6MWAYTkyiQVMVyIoCoquOHGnn3YbcjozENx2bgkG3hHbQ/YFA0wkKNRPJdSCeB96zgEo1wyQ9U0mlpo4OZQ3hVRmhVQW5km6Jhl2R3tDgT8q4saIguKIikFKQyGs00ynQiYmN38RpyPESQm94TC4LCCQFNHhqSjvYlnSE0iL8rwRcTwm4ZjPxUkCxoVpXVOU0vF5XLKPuyT28qCCw3MJYnINvoYXFL6KV+FxS4Iu1MJ7gelyltLWZD4JV85GV8XRNdBpuCwrG401cer5Jizu8yPH0GjhcnG/iSqyvd7lMa59keQRTW5jLCla3oihB0zR6ZEGG71kNI9E6RufquEA5O1vHyOP+3k1bP0/zpyM1RDO8daftV9B+gvTIKkajZZx6WIF3psOZRxUM27E30te9A9q52QqG7pfw4F3LHmTnzJ4WHcpwhMWxeyxOTLE4Pm0z9Q8GckN0PRRmcPdt02W4I+HkNIOD4SKO3GZw2KJor276+tE7DA7c/I5b6YbLkA5lf7CA3ZN57PXnsadHwRUXHNq+QAG7xr5iYqniNBREGUu5OmLZGhbWbAbj/7D4qYb5TBUZZssaSvdx/wEaeYcAxN+80wAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/8d0561ecd796b388ecb19986bcd88c3f/1e0be/graph2.webp 250w,
/static/8d0561ecd796b388ecb19986bcd88c3f/b0a15/graph2.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/8d0561ecd796b388ecb19986bcd88c3f/63868/graph2.png 250w,
/static/8d0561ecd796b388ecb19986bcd88c3f/0b533/graph2.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/8d0561ecd796b388ecb19986bcd88c3f/0b533/graph2.png&quot;
            alt=&quot;graph2&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The second script is similar to the first. It tallies all users who log on within a 1 hour period and creates two csv files: one with all the users’ names and a second called &lt;code class=&quot;language-text&quot;&gt;HourlyReport.csv&lt;/code&gt;. Each hour it creates a new line in the latter csv file.&lt;/p&gt;
&lt;h4&gt;PSLoggedOnLastHour.ps1&lt;/h4&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;powershell&quot;&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;#!powershell.exe&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# ======================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# PSLoggedOnLastHour.ps1&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Logs a list of users who logged on during the current day&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Created by Matthew Newton&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# 10.17.2012&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Queries each Domain Controller in the current domain and compiles a&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# list of distinguishedName and lastLogon attributes for each user. Then&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# it outputs only those users who have logged on during the current hour.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Heavily based on Richard L. Mueller&apos;s PSLastLogon.ps1.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Link: http://www.rlmueller.net/PowerShell/PSLastLogon.txt&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# And:  http://www.rlmueller.net/Last%20Logon.htm&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Richard&apos;s header is reproduced below:&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# ----------------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Copyright (c) 2011 Richard L. Mueller&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Hilltop Lab web site - http://www.rlmueller.net&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# Version 1.0 - March 16, 2011&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# This program queries every Domain Controller in the domain to find the&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# largest (latest) value of the lastLogon attribute for each user. The&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# last logon dates for each user are converted into local time. The&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# times are adjusted for daylight savings time, as presently configured.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# You have a royalty-free right to use, modify, reproduce, and&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# distribute this script file in any way you find useful, provided that&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# you agree that the copyright owner above has no warranty, obligations,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# or liability for such use.&lt;/span&gt;


&lt;span class=&quot;token keyword&quot;&gt;Trap&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Error: &lt;span class=&quot;token variable&quot;&gt;$_&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;Break&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;$oneHourAgo&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 class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AddHours&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;1&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token variable&quot;&gt;$D&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[System.DirectoryServices.ActiveDirectory.Domain]&lt;/span&gt;::GetCurrentDomain&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;$Domain&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[ADSI]&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;LDAP://&lt;span class=&quot;token variable&quot;&gt;$D&lt;/span&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$Searcher&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;DirectoryServices&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DirectorySearcher
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;PageSize = 200
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SearchScope = &lt;span class=&quot;token string&quot;&gt;&quot;subtree&quot;&lt;/span&gt;

&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;Filter&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;(&amp;amp;(objectCategory=person)(objectClass=user))&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;PropertiesToLoad&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Add&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;distinguishedName&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &gt; &lt;span class=&quot;token variable&quot;&gt;$Null&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;PropertiesToLoad&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Add&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;lastLogon&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &gt; &lt;span class=&quot;token variable&quot;&gt;$Null&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Create hash table of users and their last logon dates.&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$arrUsers&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;# Enumerate all Domain Controllers.&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;$DC&lt;/span&gt; In &lt;span class=&quot;token variable&quot;&gt;$D&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DomainControllers&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;$Server&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$DC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name
    &lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SearchRoot = &lt;span class=&quot;token string&quot;&gt;&quot;LDAP://&lt;span class=&quot;token variable&quot;&gt;$Server&lt;/span&gt;/&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$Domain&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;distinguishedName
    &lt;span class=&quot;token variable&quot;&gt;$Results&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Searcher&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;FindAll&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;ForEach&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Result&lt;/span&gt; In &lt;span class=&quot;token variable&quot;&gt;$Results&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;$DN&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Properties&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Item&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;distinguishedName&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token variable&quot;&gt;$LL&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Properties&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Item&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;lastLogon&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&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 variable&quot;&gt;$LL&lt;/span&gt;&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;$Last&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[DateTime]&lt;/span&gt;0
        &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 variable&quot;&gt;$Last&lt;/span&gt; = &lt;span class=&quot;token namespace&quot;&gt;[DateTime]&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$LL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Item&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$Last&lt;/span&gt; &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;$LastLogon&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Last&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AddYears&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1600&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;Else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token variable&quot;&gt;$LastLogon&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$Last&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AddYears&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;1600&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ToLocalTime&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$LastLogon&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-gt&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$oneHourAgo&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ContainsKey&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;$DN&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;If&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$LastLogon&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-gt&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&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;$DN&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 variable&quot;&gt;$arrUsers&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;$DN&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; = &lt;span class=&quot;token variable&quot;&gt;$LastLogon&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;Else&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Add&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;$DN&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$LastLogon&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;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Output file names&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$fileName&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 class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ToString&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;yyyy-MM-dd-hh-mm&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 string&quot;&gt;&quot;_&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;.csv&quot;&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$reportName&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;HourlyReport.csv&quot;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Output List of Users to CSV&lt;/span&gt;
&amp;amp;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;GetEnumerator&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;ForEach&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; PSObject &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;Property @&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;DN = &lt;span class=&quot;token variable&quot;&gt;$_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;name&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; lastLogon = &lt;span class=&quot;token variable&quot;&gt;$_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;value&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; &lt;span class=&quot;token function&quot;&gt;Export-CSV&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$fileName&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;NoType

&lt;span class=&quot;token comment&quot;&gt;# Append Total Count to CSV&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$totalRow&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;User Count: &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count
&lt;span class=&quot;token function&quot;&gt;Add-Content&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$fileName&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$totalRow&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Output Time and User Count to report CSV&lt;/span&gt;
&lt;span class=&quot;token variable&quot;&gt;$reportRow&lt;/span&gt; = &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&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 function&quot;&gt;Get-Date&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;ToString&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 string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;,&quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$arrUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count
&lt;span class=&quot;token function&quot;&gt;Add-Content&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$reportName&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$reportRow&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;Resulting report:&lt;/h4&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/23662a0d97a364b5cafdc4e0f48ab252/0b533/graph3.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 67.19999999999999%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAARlAAAEZQAGA43XUAAABvklEQVR42n1T227bMAz1///O3taXDduAYdjDgq5tCi9L07RJlLjxXdbVZyTjBmnmhgBBi6akc3ioxFqLGOOo932PqqqgNgpKKfkeqzm1xDmHHm+TrzaevWyJtUZuqrSFD+Hs9kN0PowgewehJYSURdHSgUPBq9edx8O2wTJrpTjGQ57rOxvQ0P9zJokxBj0dlDcW4XhgpA0et8sS06cSqtBHRLy9bB3SVQVtnKz7tz30ktzXFrvKSDGvW+MxUzUWu4a8xVw1kmOrtZO19fF/hF3XUSZivde4XuSYrSspaTqH2abGX/I5HZyuSiyIPlvRGNwRcku95VrjiH6rwWwHhCBaBvdEY513stbUo3RVY/pc4nv6gptlgYxYsL1Q/DbN4MIBYaQ2hUFQQcj9KUmUyXyPyUOOR6J4vSjwI83whxAzus83W/ya5/h6l+HjZCM5Vh/nKnt/QFhpj0+/tyREgQ8/V7iaKDySuizStjTHPn653eEp04PiI3MoCGNASz3blVpuZbfUijDMnHwTJWYiqjJFystUxHcQnqolo3bh5Vx6QYnWGvyejbFDNPA07BzdMVK+G9ZDZGYcec/pa/kHCSv07y7+CHoAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/23662a0d97a364b5cafdc4e0f48ab252/1e0be/graph3.webp 250w,
/static/23662a0d97a364b5cafdc4e0f48ab252/b0a15/graph3.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/23662a0d97a364b5cafdc4e0f48ab252/63868/graph3.png 250w,
/static/23662a0d97a364b5cafdc4e0f48ab252/0b533/graph3.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/23662a0d97a364b5cafdc4e0f48ab252/0b533/graph3.png&quot;
            alt=&quot;graph3&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Enjoy.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Solution: RDP: The Local Security Authority cannot be contacted]]></title><description><![CDATA[The Problem I have run into this error a few times in the past. Each time I do, I solve it and forget about it, so that it stymies me for a…]]></description><link>https://blog.mnewton.com/solution-rdp-the-local-security-authority-cannot-be-contacted/</link><guid isPermaLink="false">https://blog.mnewton.com/solution-rdp-the-local-security-authority-cannot-be-contacted/</guid><pubDate>Wed, 26 Sep 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 409px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/44fa2ff61adecdd53fb31296e031bdab/7a75e/screen1.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 62%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAACXBIWXMAAAsTAAALEwEAmpwYAAACQklEQVR42n2Q22/SYBjG+x/qvPRPcEuM0cRd6N0udEZNFNRkuAMM5dBycoobYeEwxoCPUaAn2rIN7QRaaKGltCsFLCNEjcYnv7x58uR98n75IGQvHomEQ8GAx4sEgmEYCfrhAIyELON0fXC53Ns7u1vbv9jccsGB8Ocv+344CDWa3VU7+bUw/NZWEmgb1MQsJgBaPMY7mapgJQ1eE/qjVs9oL2iKukVLuoKEbu/e2sHzncw513wbJHf3Gccnyn9YfwVjdgQ/yHNd2ZCUP+gPRopqykMTkmTNNHRBuFCHw0teqzV6+JnIcn2Wk/FzqdPTp39pMpmOx1PTnEIEgdMUtb4RvbvmfrjuefzS/+iF78GTj6vPPJa5ff/djTuvl1ZsS8u2Wyszbi7bntq9iWT6vM5ApVNQKYFUnkiUzuKATRWYNGAPc3S6OPPheBmOlQIxFImh3ijwRQu+KIhn0HQqRZSLECjkTzJJ3bjSLup9hhqoSkdoSV1e4FuyLKkDeaBImiqrSn8yniyePSGwMl45hfK5bM4qj0zw3lHYdHBtniQpqlYjazTLsmgFI0gKJ0kMJxrfOYatc5c/RuYYr6CYdfkonYyEYE0bjg1jpOuiKHU7XVGS2jyv6f/4rfllvHpdLhYLVbSoa9o8VlVVuVavLxuGMVtc6PcyVi1XywCiSJyhabaGM9SMOkPWGcqaZyzF0sQ8nAPy2exxOndynDlKneYyVAVAb9x7dmcILQEMBdX/shcJ+jxu2O8JIb4Np9fmDP0Eer5RxwLaF58AAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/44fa2ff61adecdd53fb31296e031bdab/1e0be/screen1.webp 250w,
/static/44fa2ff61adecdd53fb31296e031bdab/2e47f/screen1.webp 409w&quot;
              sizes=&quot;(max-width: 409px) 100vw, 409px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/44fa2ff61adecdd53fb31296e031bdab/63868/screen1.png 250w,
/static/44fa2ff61adecdd53fb31296e031bdab/7a75e/screen1.png 409w&quot;
            sizes=&quot;(max-width: 409px) 100vw, 409px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/44fa2ff61adecdd53fb31296e031bdab/7a75e/screen1.png&quot;
            alt=&quot;screen1&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;The Problem&lt;/h3&gt;
&lt;p&gt;I have run into this error a few times in the past. Each time I do, I solve it and forget about it, so that it stymies me for a few minutes the next time I run into it. Hopefully after writing this post I’ll remember next time.&lt;/p&gt;
&lt;h3&gt;The Error&lt;/h3&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;Remote Desktop Connection:

An authentication error has occurred.
The Local Security Authority cannot be contacted

Remote Computer: hostname or ip&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;The Reason&lt;/h3&gt;
&lt;p&gt;There are myriad reasons why this could crop up. However, for me it has always been one:&lt;/p&gt;
&lt;h4&gt;User must change password on next logon&lt;/h4&gt;
&lt;p&gt;Under many situations (such as when the local computer isn’t a member of the remote computer’s domain) the Remote Desktop Connection application can’t handle the prompt to change a user’s password when Network Level Authentication is enabled.&lt;/p&gt;
&lt;h3&gt;One step forward, two steps back&lt;/h3&gt;
&lt;p&gt;With previous versions of the RDP protocol, a user was allowed to change their password graphically after signing on. However, NLA has no such provision, at least the way it’s implemented in RDC. So, if you have to change your password you are SOL unless you can get to a console.&lt;/p&gt;
&lt;h3&gt;Workaround&lt;/h3&gt;
&lt;p&gt;In my case, I was able to sign on to a domain member’s console using the VMware vSphere Virtual Machine Console. When I did that, I got a friendly password change screen:&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/e6696d33e92880810a03f2e67d4ce244/0b533/screen2.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 45.2%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB9ElEQVR42mPQso+RMgqR1XUwsnbSMrE1sHLWNLYFspUNHeXNwrQdYhXNwzTtYlWtIrlU3BlkHJlknSCIUcaRQc85Qc40XNfcycXZuqWl8dHDezW1lc7ONpb2LixyzhyKrszSDvxqnvImIVzyTgxClgwiVhDEKGXPwCRpzyDhoGflam1jtmffvv///x84eNDK2szExlnNJsYpJM8hOM8rpsI3oconvso7rhKIvGIr/BKrRXUDGJhlHRmkHXUtnJycbDu7uu7cuTNl6lRXNwcdE5v43NYVa3csWL513dbDELR+2xEgWrv18JbdJ/VdkhmYgJplnJV0LZYvW/z8+csNGzc+ePho9+6dGgaWgUk10+ev75qypHf68qnzN0yZB0WT5qxfuHyrtn0cULMTg6SDgZXLvTs3gG7+8+cPkPzw/o2ti3dkZtOazQcWrti2ZPXOFev3rdlyCIhWbz60Ycuh7Im7xc3jwZol7LUsPDds3XP45KU9h04fOHZh7+FTpo6Bph4pGSWdEel1QUnV4en10dktUVnNkVnNcbmtBqENXJoBDMAQhyAGSTsGCVsEknbgUvHiVfdhlXdlkHRkkAI60AnEACIhKwZRS0Zpe4RmZjlnZAQUYVF0Z1PxYVf14VD15lD35dTw41QHIl8WBWcmOWcmGUcAES293Z4mR6wAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/e6696d33e92880810a03f2e67d4ce244/1e0be/screen2.webp 250w,
/static/e6696d33e92880810a03f2e67d4ce244/b0a15/screen2.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/e6696d33e92880810a03f2e67d4ce244/63868/screen2.png 250w,
/static/e6696d33e92880810a03f2e67d4ce244/0b533/screen2.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/e6696d33e92880810a03f2e67d4ce244/0b533/screen2.png&quot;
            alt=&quot;screen2&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;After setting a new password, subsequent Remote Desktop logons work fine.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[proxy-toggle.sh]]></title><description><![CDATA[Reason for Being I need to change my proxy settings regularly depending on which network I’m connected to. I initially tried Proxy Switchy…]]></description><link>https://blog.mnewton.com/proxy-toggle/</link><guid isPermaLink="false">https://blog.mnewton.com/proxy-toggle/</guid><pubDate>Thu, 13 Sep 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/c1e7fda17dda109c9936f7954a147249/0b533/screen1.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 98%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAARlAAAEZQAGA43XUAAAB9UlEQVR42qVUXXPSUBDlX+hYZ7SBQCAJ3HvzHfIBwQf/lLWtTkfAdiqjL/7Z4+5i+lIKER/O7IVMTnb3nHN793d32O3W+P3rAY+7R/z4+YD1ZovNdkt1g8/XN/h0dYXbL19xfXOLb+sNtt/vD4Lf66kggTYaSitYQxuWPcD7PsHqS70c2OgPh3hnWXh98Vbw6s3Fi+gtmgbL1QdUywbzqkY2L5Dkc2RFSSiQ0u84y+Q8Mwaj8eQoevOyRl5W8JWmTkawnfEzDEaO1CG9wOdj6JX1Qjpy/amMZ9lDAZMfwklCFQQwUQwdhlAmgA721Z3O4BHaOqEPniITwpp2Vy2W4E6jNEWYpAjimFagZA0tmLgTYVHXIkaYZNKFM/HguN6LuzxJqE2GMDQIzBRTso6OjBB3JXhGuGg+oihzaOXLmCPXEVHOIRPCLGuQ5xFKgo4DeMolNZ3zCdnQFQnCaNUWxYPw6azDiNZhOnZIiZiTsZMsJ2ESUjgR63BltQ2RMTk/Y7VPEkrsyDb+TB01dBdTC2GUksrUDSdFUvIPLx8k5NFiGjf5C74MuHKCeNS2dhl3b5vVSlLCt8yMIsejM8a+T34keP7e8GT2jiPnQmaiSOLFGBMJPzxrh2m2hNY+IuNhFmhKipL42c6ZO3SnCrbcd+2f/yfKH2rZbaHDEAM2AAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/c1e7fda17dda109c9936f7954a147249/1e0be/screen1.webp 250w,
/static/c1e7fda17dda109c9936f7954a147249/b0a15/screen1.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/c1e7fda17dda109c9936f7954a147249/63868/screen1.png 250w,
/static/c1e7fda17dda109c9936f7954a147249/0b533/screen1.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/c1e7fda17dda109c9936f7954a147249/0b533/screen1.png&quot;
            alt=&quot;Screen 1&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;Reason for Being&lt;/h2&gt;
&lt;p&gt;I need to change my proxy settings regularly depending on which network I’m connected to. I initially tried &lt;a href=&quot;https://www.google.com/url?sa=t&amp;#x26;rct=j&amp;#x26;q=&amp;#x26;esrc=s&amp;#x26;source=web&amp;#x26;cd=1&amp;#x26;cad=rja&amp;#x26;ved=0CCIQFjAA&amp;#x26;url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fcaehdcpeofiiigpdhbabniblemipncjj&amp;#x26;ei=pDxSUMa4M4zQigLh-IGgAQ&amp;#x26;usg=AFQjCNG68edvuAF1w8GAa1G_BM5cAgmeww&quot;&gt;Proxy Switchy&lt;/a&gt; but found that it took up too much CPU time. There is no excuse for that in such a simple utility, so I decided to trash it and do things the old fashioned way.&lt;/p&gt;
&lt;p&gt;##Method&lt;/p&gt;
&lt;p&gt;It turns out that it’s quite trivial to change proxy settings on OS X:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&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;sudo&lt;/span&gt; networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-setsocksfirewallproxy&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;network service&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;proxy_host&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;port_number&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&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;sudo&lt;/span&gt; networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-setsocksfirewallproxy&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Wi-Fi&quot;&lt;/span&gt; localhost &lt;span class=&quot;token number&quot;&gt;1080&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then you turn if off with:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&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;sudo&lt;/span&gt; networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-setsocksfirewallproxystate&lt;/span&gt; off&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Script&lt;/h2&gt;
&lt;p&gt;However, I can’t be trusted to remember the full commands and arguments so I wrote a tiny script to do it:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&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;#!/bin/sh&lt;/span&gt;

&lt;span class=&quot;token assign-left variable&quot;&gt;PROXY_INTERFACE&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;USB Ethernet&quot;&lt;/span&gt;
&lt;span class=&quot;token assign-left variable&quot;&gt;PROXY_HOST&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;localhost
&lt;span class=&quot;token assign-left variable&quot;&gt;PROXY_PORT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1080&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 variable&quot;&gt;$1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;on&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 function&quot;&gt;sudo&lt;/span&gt; networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-setsocksfirewallproxy&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PROXY_INTERFACE&lt;/span&gt;&quot;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$PROXY_HOST&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$PROXY_PORT&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;SOCKS proxy enabled&quot;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;elif&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;$1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;off&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 function&quot;&gt;sudo&lt;/span&gt; networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-setsocksfirewallproxystate&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PROXY_INTERFACE&lt;/span&gt;&quot;&lt;/span&gt; off
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;SOCKS proxy disabled&quot;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;elif&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;$1&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;status&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;======================================================&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;Network Services:&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;======================================================&quot;&lt;/span&gt;
    networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-listallnetworkservices&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&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;======================================================&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;Current SOCKS Proxy Settings:&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;======================================================&quot;&lt;/span&gt;
    networksetup &lt;span class=&quot;token parameter variable&quot;&gt;-getsocksfirewallproxy&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;$PROXY_INTERFACE&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 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;&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;basename&lt;/span&gt; $0&lt;span class=&quot;token variable&quot;&gt;`&lt;/span&gt;&lt;/span&gt; toggles SOCKS proxy settings on OS X&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&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: &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;  $ proxy on           # turns SOCKS proxy on&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;  $ proxy off          # turns SOCKS proxy off&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;  $ proxy status       # prints status of proxy settings&quot;&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&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;proxy interface:      &quot;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$PROXY_INTERFACE&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;proxy host:           &quot;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$PROXY_HOST&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;proxy port:           &quot;&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$PROXY_PORT&lt;/span&gt;
    &lt;span class=&quot;token builtin class-name&quot;&gt;echo&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;65&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;# end process with error to indicate incorrect arguments&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Cheers.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Ruby is slow, but itʼs the same speed as comparable languages]]></title><description><![CDATA[Ruby has a fairly well deserved reputation as a slow language. I tend to think that for its most relevant use cases (running high level…]]></description><link>https://blog.mnewton.com/ruby-is-slow-but-its-the-same-speed-as-comparable-languages/</link><guid isPermaLink="false">https://blog.mnewton.com/ruby-is-slow-but-its-the-same-speed-as-comparable-languages/</guid><pubDate>Thu, 30 Aug 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Ruby has a fairly well deserved reputation as a slow language. I tend to think that for its most relevant use cases (running high level programs like &lt;a href=&quot;http://redcareditor.com/&quot;&gt;text editors&lt;/a&gt; and &lt;a href=&quot;http://basecamp.com/&quot;&gt;web sites&lt;/a&gt;, &lt;a href=&quot;http://www.ruby-lang.org/en/documentation/success-stories/&quot;&gt;etc&lt;/a&gt;) it doesn’t much matter. You could always write your application in C or Java, but who wants to do that if they can help it?&lt;/p&gt;
&lt;p&gt;In his article, &lt;a href=&quot;http://www.unlimitednovelty.com/2012/06/ruby-is-faster-than-python-php-and-perl.html&quot;&gt;Ruby is faster than Python, PHP, and Perl&lt;/a&gt;, &lt;a href=&quot;http://www.blogger.com/profile/05698660503129206682&quot;&gt;Tony Arcieri&lt;/a&gt; claims that Ruby is faster than these other languages. He uses this table to illustrate his point:
&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 116.40000000000002%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAXCAYAAAALHW+jAAAACXBIWXMAARlAAAEZQAGA43XUAAAD/UlEQVR42mVVaXOiWhT0//+k+TA1U5ksZlzQmBmJKKvsIGI0ikC/Phc1ee9ZRV1k6dunu8+hN19YmBsxtFcHz4MZ/vzVsV57SNMUtm3DcRy1Lg0D47EGXddxf38Pw1ji5eWFz65hLA34vs91id7CDHE3OWNiNFi6LdwIqJsW8kviGHmWIyN4EkcIwwjH4xHD4RBplvFagu12iyAIsNvtCO6jl6QbDPUKK+8MJ6xR7FrUdQcYRxEyvihs4yjEmiw+Pj4wnUyQ5RtuEHwBLOG6LnqzNw+6XcFwa1j+Gbs9wdr/ACYJojBUZQmgpmnI8xwB/2+3JTzXQ1mWsB0Cmk6Ex9kJ2/eO2fncgamSCVQUhWIowAK4PxwwIcPNpoBP/QRIdBSmDoF7OjX8OT7Bi2sF0pBd0zTqXEA2mw3yTa7AgyBUDAUwVRt0gHK9KLYwLZuAKx/f+kdMjTPSosHHURh2LNM0Uw9KeQIeRjH27++YTqfqfxCwZAIK85IMXc/vSv41OeJpVmFhn2H7NYKkhhidJPGt3IBsfLp42O8xGAwuEqyxe99RQ5eAJSzboSm6i8fpES9kGKY1jqcG74dacZTYXF2+mnI47NHv97lZCs9zlcaex9xmKXyW3pvqHp5fT3izxeFGldu2zc2Ua7niuMRDGD48PKh7wlAkEVNCbqhcjuMcP0cnLNedKZ8eQzHLxRSCRsxhRNADXX56euo0JUhZ7hRzMU8B6ssAP0bU8LVS2hW75sYw/lJyyJdEQzFF0ya8l6ggyz1pT5FkwXbsLe2YJVcY/q0wtyoFeI3N15I7DQPFUBuPyS6GSyBx2lebSU+bXac8vpyg6WdUl1BfGuWWQznEINFwTw2fn59VDhVDrqKhMHUl2J6fQnurcKxaFZW2+Qy2lChZFK2kzSzTUkNAYiMlry+dIiXLEFHBtjhevg84QeYV49Jw0nyaIoyu4kecNLLBhl0zGo3VZIkYdDkC3he9XW+N3pBz8MfwyG5h2QSNshppXiPfgi8FSkN5OLqwDKjjmBpK9mRDiZNDd0OeC+PeaGaj/9r1crZtUJQNAWVt2WqdkzIHTdNULzqOTQ1/q+sCKiPM4gCWTKrYOF4M3ayQFTUSMmvbz16OVJhDVbLoJ+e2bTHYj3TYVZNdgC1uJudvC4Muzx2MBz70RUlmFZhC6tgJKWWIw7eSCSgGSKfIKmC23a3GYoGVmDL+4+BudMBofsJm11xi0/57fHE6d4Asz7Iw4CfgylyAHYLKumIVvSE1/DU5Yf/R/m8eSskSbonIVXRztVIfqRVXAexY8mPGQwGunBh3Gj8B/Ka4NKY6f8ZGSpVJfJ02ig2P3zRFAB2XrFZLZY76Mq5M/AO1FbH4aTHY+QAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/4645d3b89ee7b022aa825f1eaf8fadc2/1e0be/img1.webp 250w,
/static/4645d3b89ee7b022aa825f1eaf8fadc2/b0a15/img1.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/4645d3b89ee7b022aa825f1eaf8fadc2/63868/img1.png 250w,
/static/4645d3b89ee7b022aa825f1eaf8fadc2/0b533/img1.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/4645d3b89ee7b022aa825f1eaf8fadc2/0b533/img1.png&quot;
            alt=&quot;img1&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is Ruby really faster though? Not really. It’s really effectively the same as these other languages. Check out this graph for some perspective:&lt;/p&gt;
&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 480px; width: 100%;&quot;
    &gt;
      &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 62.4%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAACXBIWXMAAAsTAAALEwEAmpwYAAABDklEQVR42oWS6Y6DMAyEef93rEAIxH2HY4Eu/cgIdnvPjzS4Hs/YsTNN0zAMxph5nvu+51yWhSDnuq7btv1abP+gCP86aZrCHMeRDzjchwMEr/cgh/OPnCRJVVVd1/0cmC1gcl7fA2tOHMeotW3Lh/w3TTNZUPHUecaunOf56ZCeIZRlWRQFdyoifjb5gkweBLUtMl7CMHRdl3EQJO+tbUzCqeuaJNlGUJOjfzI+2UaZVI2HyVGIEiLrwT6RoyjqLTRqKVOFotih4hfbyDI2ztRCl9ZCe/KwHtqZXZkfalwsmJOGl2UZspD17Of7Q1gO0NROxoM2DFCVaBAEiNOR53lske/7RHgFSpDZWRhjbs52uF66FzxxAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/d923e0fabb2dda71dfab8d9ad39724f6/1e0be/img2.webp 250w,
/static/d923e0fabb2dda71dfab8d9ad39724f6/d3be9/img2.webp 480w&quot;
              sizes=&quot;(max-width: 480px) 100vw, 480px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/d923e0fabb2dda71dfab8d9ad39724f6/63868/img2.png 250w,
/static/d923e0fabb2dda71dfab8d9ad39724f6/e85cb/img2.png 480w&quot;
            sizes=&quot;(max-width: 480px) 100vw, 480px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/d923e0fabb2dda71dfab8d9ad39724f6/e85cb/img2.png&quot;
            alt=&quot;img2&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
    &lt;/span&gt;
see source: &lt;a href=&quot;http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php&quot;&gt;http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I don’t consider this an indictment of Ruby. Actually, I see it as a great reason to use it. If I can get the same performance out of Ruby as Python, PHP, or Perl then I am certainly not going to choose Perl. As for Python or PHP, I think the choice is a matter of taste. I personally like the elegant readability of Ruby. It is written more for my brain than for a CPU. And it’s not any slower than the more C-like Python and it’s proven itself much more malleable than PHP. Good stuff.&lt;/p&gt;
&lt;p&gt;And as for Rails? I don’t think its performance is anything to worry about either:
&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/69e439afab417926ab05895a43844707/0b533/img3.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 62%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAACXBIWXMAARlAAAEZQAGA43XUAAABuElEQVR42p1SOUsDQRhNK1iKJ4iFhZ2ljYKdYCNesRArsRF/hgdWFlbWbhQ8QO00CUo2l0qMR6MbkmwOJWvcc5LgzuzO+u0uEQ2x8THM7hzv+GbGY9VBKSXEwNgAmKYJQ+gJIdbf8NSZJqpU8rnsWyFTLOSfX7hslk+n0xkHIOdo2a0JGduOuFjWb581rUocOetnKEppE2d3QcdAoKu7fMdkhH2UCTG5Ys1Rcd1o7dMovH/K6FcVHqhKURQdG5Zlbvhy3TORO047uBL65+OnkbIditieoDi4eLt1mIf/7/A2WZZl7JKZXPdUJMlpjL/UORU9Dr3DDlTF0F8mpV5vdI3hG8miKGICZArOXUBOof2gACrBhBR+UgYWrk/DZZjsm4tt7uUayZIkubHXGb5rGmKrPn8Jig8kxPObj5ax0O5FCeL0emMbDc7ugTnO1hqTb5+M3XHIFxTaJqKBhOxPyK3jYV9ASKYqPbPxdea3s/sxnCPdPuRGltkHTjwK8sPL4VCyxN4LQ0vsGfv6kBJHV9idk4xNpo2PxJ5ASFMUCe5cVVVNVXRdJwZBSDUMYl+KDEt6k0fyP3wBLWB/Xza/AKkAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/69e439afab417926ab05895a43844707/1e0be/img3.webp 250w,
/static/69e439afab417926ab05895a43844707/b0a15/img3.webp 500w&quot;
              sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/69e439afab417926ab05895a43844707/63868/img3.png 250w,
/static/69e439afab417926ab05895a43844707/0b533/img3.png 500w&quot;
            sizes=&quot;(max-width: 500px) 100vw, 500px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/69e439afab417926ab05895a43844707/0b533/img3.png&quot;
            alt=&quot;img3&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;see source: &lt;a href=&quot;http://blog.curiasolutions.com/the-great-web-framework-shootout/&quot;&gt;http://blog.curiasolutions.com/the-great-web-framework-shootout/&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Customizing Mac OS X Shell]]></title><description><![CDATA[I’ve been customizing my Mac OS X shell a bit today. The cyan above is for the current directory and the purple shows the current git branch…]]></description><link>https://blog.mnewton.com/customizing-mac-os-x-shell/</link><guid isPermaLink="false">https://blog.mnewton.com/customizing-mac-os-x-shell/</guid><pubDate>Wed, 22 Aug 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span
      class=&quot;gatsby-resp-image-wrapper&quot;
      style=&quot;position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 808px; width: 100%;&quot;
    &gt;
      &lt;a
    class=&quot;gatsby-resp-image-link&quot;
    href=&quot;/static/88468b05203ed8c01ef9c2df1a9e965f/3534c/screen1.png&quot;
    style=&quot;display: block&quot;
    target=&quot;_blank&quot;
    rel=&quot;noopener&quot;
  &gt;
    &lt;span
    class=&quot;gatsby-resp-image-background-image&quot;
    style=&quot;padding-bottom: 26.400000000000002%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA6ElEQVR42n2Oy06DQBSG51GgDLcZ7tBApKFqg61p3flo7pTLpEBYsKhP+DsQ60br4sv5Jznnm5+I9zeIrkZT1RBti3Eccbl8YpqmJQ/DgFYI1E2Dj6paZtf16PvhF+dzB5Jtj7grSmS7EjyKoaw0qBqFIlnpBlSqL1nRtCWr1Ph+/w3Zl6942J2QH19Q7A9gjgsniOAGISzuwJefcM+Ht05hux6oaUG37JuQ+6cTwiRFkuV4fjxgHSaI8w2YlJiMY1NspZgjTjMEUj63nqW3IMyJ5IEPe27lh2CyFTXMnwXdui6b/4quwi+jErMp0dGTGAAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;&quot;
  &gt;&lt;/span&gt;
  &lt;picture&gt;
          &lt;source
              srcset=&quot;/static/88468b05203ed8c01ef9c2df1a9e965f/1e0be/screen1.webp 250w,
/static/88468b05203ed8c01ef9c2df1a9e965f/b0a15/screen1.webp 500w,
/static/88468b05203ed8c01ef9c2df1a9e965f/2b269/screen1.webp 808w&quot;
              sizes=&quot;(max-width: 808px) 100vw, 808px&quot;
              type=&quot;image/webp&quot;
            /&gt;
          &lt;source
            srcset=&quot;/static/88468b05203ed8c01ef9c2df1a9e965f/63868/screen1.png 250w,
/static/88468b05203ed8c01ef9c2df1a9e965f/0b533/screen1.png 500w,
/static/88468b05203ed8c01ef9c2df1a9e965f/3534c/screen1.png 808w&quot;
            sizes=&quot;(max-width: 808px) 100vw, 808px&quot;
            type=&quot;image/png&quot;
          /&gt;
          &lt;img
            class=&quot;gatsby-resp-image-image&quot;
            src=&quot;/static/88468b05203ed8c01ef9c2df1a9e965f/3534c/screen1.png&quot;
            alt=&quot;Shell Screen 1&quot;
            title=&quot;&quot;
            loading=&quot;lazy&quot;
            decoding=&quot;async&quot;
            style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;&quot;
          /&gt;
        &lt;/picture&gt;
  &lt;/a&gt;
    &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I’ve been customizing my Mac OS X shell a bit today. The cyan above is for the current directory and the purple shows the current git branch, which is why it appears when I change directory to a git repository.&lt;/p&gt;
&lt;p&gt;##FIRST: oh-my-zsh
I used &lt;a href=&quot;https://github.com/robbyrussell/oh-my-zsh&quot;&gt;oh-my-zsh&lt;/a&gt; to start, but I didn’t like any of the included themes.&lt;/p&gt;
&lt;p&gt;##NEXT: thoughtbot/dotfiles
The thoughtbot guys have put together a nice &lt;a href=&quot;https://github.com/thoughtbot/dotfiles&quot;&gt;zsh dotfiles setup&lt;/a&gt;. They include a handy little script that symlinks from the dotfiles directory to your .* files themselves, making it easy to link up your dotfiles to a github repository for sharing and copying to additional computers.&lt;/p&gt;
&lt;p&gt;##CUSTOMIZING
My contribution to all this? I extracted the code the thoughtbot guys used to generate their prompt and made a zsh-theme file out of it:&lt;/p&gt;
&lt;h4&gt;oh-my-zsh/themes/thoughtbot.zsh-theme:&lt;/h4&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&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;# adds the current branch name in green&lt;/span&gt;
  &lt;span class=&quot;token function-name function&quot;&gt;git_prompt_info&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 assign-left variable&quot;&gt;ref&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;git&lt;/span&gt; symbolic-ref HEAD &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;
    &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;-n&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;$ref&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;[%{&lt;span class=&quot;token variable&quot;&gt;$fg_bold&lt;/span&gt;[magenta]%}&lt;span class=&quot;token variable&quot;&gt;${ref&lt;span class=&quot;token operator&quot;&gt;#&lt;/span&gt;refs&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;heads&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;}&lt;/span&gt;%{&lt;span class=&quot;token variable&quot;&gt;$reset_color&lt;/span&gt;%}]&quot;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;fi&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;# expand functions in the prompt&lt;/span&gt;
  setopt prompt_subst

  &lt;span class=&quot;token comment&quot;&gt;# prompt&lt;/span&gt;
  &lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;PROMPT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;$(git_prompt_info)[${SSH_CONNECTION+&quot;%{$fg_bold[green]%}%n@%m:&quot;}%{$fg_bold[blue]%}%1~%{$reset_color%}] &apos;&lt;/span&gt;

  &lt;span class=&quot;token builtin class-name&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;token assign-left variable&quot;&gt;return_status&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;$fg&lt;/span&gt;[red]%}%(?..✘)%{&lt;span class=&quot;token variable&quot;&gt;$reset_color&lt;/span&gt;%}&quot;&lt;/span&gt;
  &lt;span class=&quot;token assign-left variable&quot;&gt;RPROMPT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&apos;${return_status}%{$reset_color%}&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I added an idea from &lt;a href=&quot;http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/&quot;&gt;Steve Losh&lt;/a&gt; and from &lt;a href=&quot;http://blog.munge.net/2011/10/fun-with-zsh-themes/&quot;&gt;Aaron Malone&lt;/a&gt;. By the way, I really like those themes as well. I recommend Aaron’s version just because it’s a little more robust.&lt;/p&gt;
&lt;p&gt;What theme am I using in the screenshot? Tomorrow Night Eighties from &lt;a href=&quot;https://github.com/chriskempson/Tomorrow-Theme&quot;&gt;Chris Kempson’s Tomorrow Night Eighties&lt;/a&gt; for &lt;a href=&quot;http://www.iterm2.com&quot;&gt;iTerm2&lt;/a&gt;. I’m also using the Tomorrow Theme to highlight the code above.&lt;/p&gt;
&lt;p&gt;##My Files
You can check out &lt;a href=&quot;https://github.com/mnewt/dotfiles&quot;&gt;my dotfiles&lt;/a&gt; and &lt;a href=&quot;https://github.com/mnewt/oh-my-zsh&quot;&gt;customized oh-my-zsh&lt;/a&gt; on my &lt;a href=&quot;https://github.com/mnewt&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Feedback and suggestions welcome.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Add Code Syntax Highlighting to any page in “Two” Lines]]></title><description><![CDATA[Background A while back I wrote a brief post in which I shared some simple code to automatically highlight the syntax of code blocks on a…]]></description><link>https://blog.mnewton.com/add-code-syntax-highlighting-to-any-page-in-two-lines/</link><guid isPermaLink="false">https://blog.mnewton.com/add-code-syntax-highlighting-to-any-page-in-two-lines/</guid><pubDate>Fri, 10 Aug 2012 00:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;A while back I wrote a brief post in which I shared some simple code to automatically highlight the syntax of code blocks on a blog, &lt;a href=&quot;/code-syntax-highlighting-in-tumblr/&quot;&gt;Code Syntax Highlighting in Tumblr&lt;/a&gt;. I want to revisit that post for two reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I want to more fully explain how all this works&lt;/li&gt;
&lt;li&gt;I have created a small project called &lt;strong&gt;prettify-wrapper&lt;/strong&gt; to handle most of the housekeeping, making for a packaged and streamlined code highlighting solution.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;prettify-wrapper&lt;/h2&gt;
&lt;p&gt;I created a repository on github to house the wrapper code, support code, and accompanying themes. You can link directly to it to use it on your site. Please check it out:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://github.mnewton.com/prettify-wrapper/&quot;&gt;http://github.mnewton.com/prettify-wrapper/&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Why this method? and why google-code-prettify?&lt;/h2&gt;
&lt;p&gt;There are tons posts on this subject but most fall short of ideal. Here is why this method is better:&lt;/p&gt;
&lt;h4&gt;It’s simple.&lt;/h4&gt;
&lt;p&gt;It involves one cut and paste and virtually no thought.&lt;/p&gt;
&lt;h4&gt;Nothing changes on the server.&lt;/h4&gt;
&lt;p&gt;It is completely self-contained in one spot in the html. All the rendering happens client side using javascript.&lt;/p&gt;
&lt;h4&gt;You don’t have to modify html in your posts.&lt;/h4&gt;
&lt;p&gt;This solution does not require any special tags, CSS, or configuration when you post some code. Just wrap your code in &lt;code class=&quot;language-text&quot;&gt;&amp;lt;pre&gt;&amp;lt;code&gt;&lt;/code&gt; tags like you see below. Blogging platforms do that anyway so for most people they do not need to do anything other than copy and paste to get the job done.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&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;pre&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;code&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    printf(&quot;Hello World!&quot;);
&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;code&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;pre&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;/div&gt;
&lt;h2&gt;The Code&lt;/h2&gt;
&lt;p&gt;If you just want this thing to work, copy and paste this code right before your &lt;code class=&quot;language-text&quot;&gt;&amp;lt;/body&gt;&lt;/code&gt; tag:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- ======================= Begin Prettify ============================--&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;link&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;rel&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;stylesheet&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;type&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;text/style&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;href&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;http://github.mnewton.com/prettify-wrapper/themes/prettify.css&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;script&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;type&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;text/javascript&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;src&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;http://github.mnewton.com/prettify-wrapper/wrapper.min.js&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 script&quot;&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;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- ======================== End Prettify =============================--&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What? You say that’s more than two lines? Well, it’s two statements that call upon many more lines of actual code. But it’s basically two lines of code that you have to worry about. The rest is all behind the scenes.&lt;/p&gt;
&lt;h2&gt;Credits&lt;/h2&gt;
&lt;h4&gt;The originial google-code-prettify&lt;/h4&gt;
&lt;p&gt;You can check out more about &lt;a href=&quot;http://google-code-prettify.googlecode.com/svn/trunk/README.html&quot;&gt;google-code-prettify here&lt;/a&gt;.&lt;/p&gt;
&lt;h4&gt;Inspiration&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://ghoti143.tumblr.com/post/1412901908/google-code-prettify-tumblr-love&quot;&gt;http://ghoti143.tumblr.com/post/1412901908/google-code-prettify-tumblr-love&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify&quot;&gt;http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.avoid.org/?p=78&quot;&gt;http://www.avoid.org/?p=78&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Feedback and Pull Requests are welcome. You can comment here or interact with the project via github.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Unrolling Citrix Single Sign-On Plugin]]></title><description><![CDATA[The Problem The Citrix Single Sign-On Plugin (aka Citrix Password Manager) is a decent way to manage user passwords across a typical, fairly…]]></description><link>https://blog.mnewton.com/unrolling-citrix-single-sign-on-plugin/</link><guid isPermaLink="false">https://blog.mnewton.com/unrolling-citrix-single-sign-on-plugin/</guid><pubDate>Wed, 18 Jul 2012 00:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;The Problem&lt;/h2&gt;
&lt;p&gt;The Citrix Single Sign-On Plugin (aka Citrix Password Manager) is a decent way to manage user passwords across a typical, fairly homogeneous Windows Enterprise Environment. It is not given as much love by Citrix as I would like, and it has its quirks. But all password management systems do.&lt;/p&gt;
&lt;p&gt;Today, though, I found a particulary irksome quirk. There is no way to tell the install routine NOT to install the Java Bridge module, which is used to save and replay passwords in Java applications. Most would not find this a horrible problem, but my client happens to have a Java application that is horribly broken by Citrix’s Java Bridge module. So it has to go!&lt;/p&gt;
&lt;p&gt;Other modules can be easily installed, or not, using command line switches. See Citrix’s documentation:
&lt;a href=&quot;http://support.citrix.com/proddocs/topic/passwordmanager/pm-install-agent-to-silent-install.html&quot;&gt;To install the Password Manager agent software silently from a command prompt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You think perhaps there is an install option but it’s just not documented? I doubt this. if you comb through the install media, including the XML file &lt;code class=&quot;language-text&quot;&gt;(SSOPlugin32Metadata.xml)&lt;/code&gt;, you will not find any reference at all to the Java module. It appears to be needlessly baked in.&lt;/p&gt;
&lt;p&gt;How do we engineer around this deficiency?&lt;/p&gt;
&lt;h2&gt;Preparation&lt;/h2&gt;
&lt;p&gt;First, I grabbed the CitrixSSOPlugin32.exe from the XenApp 6.5 media. It is a self-contained .exe installer. However, like most .exe installers, it can be easily split up into its constituent parts using 7-zip or RAR.&lt;/p&gt;
&lt;p&gt;Along with support files and directories, you will find two standard .msi files: one for Citrix Receiver and one for SSO.&lt;/p&gt;
&lt;h2&gt;Solution: MSI Administrative Install&lt;/h2&gt;
&lt;p&gt;Once I had the raw msi files, the rest is easy and well documented by Microsoft. I create an Administrative Install.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;msiexec&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/a&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Citrix Single Sign-On.msi&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After running the above command, a standard install wizard popped up. I went through it as you would in a manual install until it completed.&lt;/p&gt;
&lt;p&gt;Once completed, however, I was left with a new directory containing an Administrative Install, with all of the options and parameters I chose during the wizard baked directly into the installation.&lt;/p&gt;
&lt;p&gt;That’s all there is to it. I did, however, think of some alternative solutions if that didn’t work.&lt;/p&gt;
&lt;h2&gt;Alternative Solution #1&lt;/h2&gt;
&lt;p&gt;You could use &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/aa370557%28v=vs.85%29.aspx&quot;&gt;Microsoft Orca&lt;/a&gt; to rip out the offending section. This is a very brute force way of accomplishing our goal. Simply search for Java in the modules section and delete the reference.&lt;/p&gt;
&lt;h2&gt;Alternative Solution #2&lt;/h2&gt;
&lt;p&gt;Lastly, if none of those options worked my last resort was to simply unlink the JavaBridge.dll:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;regsvr32&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/u&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;C:\Program Files\Citrix\Password Manager\helper\JavaBridge.dll&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thankfully, the administrative install worked perfectly for our case.&lt;/p&gt;
&lt;p&gt;All of this would be unnecessary, however, if Citrix exposed a transform option to disable that module, just as they do for other modules in the Plugin. Please update your install routines, Citrix! There is a reason MSI files were created and when you gloss over functionality that is baked into the architecture in the first place you hurt yourselves and you hurt your users.&lt;/p&gt;
&lt;p&gt;Please let me know if any of this helped you out. Cheers.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Windows Installer Batch Script Revisited]]></title><description><![CDATA[Recap In a previous post, “Windows Versioning and UAC Elevation in a Batch Script”, I shared a script I wrote (with the help of some other…]]></description><link>https://blog.mnewton.com/windows-installer-batch-script-revisited/</link><guid isPermaLink="false">https://blog.mnewton.com/windows-installer-batch-script-revisited/</guid><pubDate>Wed, 18 Jul 2012 00:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;Recap&lt;/h2&gt;
&lt;p&gt;In a previous post, &lt;a href=&quot;/windows-versioning-and-uac-elevation-in-a-batch-script/&quot;&gt;“Windows Versioning and UAC Elevation in a Batch Script”&lt;/a&gt;, I shared a script I wrote (with the help of some other blogs) in order to install Citrix Single Sign-On (aka Password Manager). It is modular, however, and there are a numer of pieces that could be repurposed for a variety of automated installation applications.&lt;/p&gt;
&lt;p&gt;Since publishing that post, I have evolved the script noticeably. The biggest changes revolve around my client’s changing needs with respect to the specifics of the Citrix Single Sign-On deployment.&lt;/p&gt;
&lt;h2&gt;Lessons Learned&lt;/h2&gt;
&lt;p&gt;However, there are a number of things that I learned while writing and revising this script that I think will be useful to those who need to deploy Windows applications across a network. These include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to detect Windows versions using just batch script&lt;/li&gt;
&lt;li&gt;How to Elevate UAC with a single batch script&lt;/li&gt;
&lt;li&gt;How to properly run a batch script with multiple parts from a UNC path&lt;/li&gt;
&lt;li&gt;How best to react to installer success, error, and reboot prompts from batch scripts&lt;/li&gt;
&lt;li&gt;How to check for installation of a package and install it only if necessary, all from the batch script&lt;/li&gt;
&lt;li&gt;How to uninstall a package from a batch script&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I think that’s a sizable percentage of the common problems you find when writing slightly complex install scripts&lt;/p&gt;
&lt;h2&gt;Why batch files?&lt;/h2&gt;
&lt;p&gt;There are many systems to deploy applications to Windows computers. You have fancy things like Microsoft System Center Configuration Manager (SCCM) and other tools like VBScript and PowerShell. Only VBScript is ubiquitous across Windows XP and up. When necessary, VBScript is a nice tool; however, it’s a lot heavier to develop and would have made this script much longer, without adding anything particularly useful.&lt;/p&gt;
&lt;h2&gt;Detect Windows versions&lt;/h2&gt;
&lt;p&gt;First, we need to know what we’re working with. We use the &lt;code class=&quot;language-text&quot;&gt;ver&lt;/code&gt; command together with &lt;code class=&quot;language-text&quot;&gt;findstr&lt;/code&gt; (Windows’ answer to &lt;code class=&quot;language-text&quot;&gt;grep&lt;/code&gt;) to decide which version of Windows the script is running against:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Check Windows Version&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.0\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_2000&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.1\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_XP&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.2\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_2003&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;6\.0\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;6\.1\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_Win7&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; warn_and_proceed&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Elevate User Account Control (UAC)&lt;/h2&gt;
&lt;p&gt;The crux of this script is handling Windows Vista/7 User Account Control. Since the script could have been run in an un-elevated state, we need to check and if necessary run a new script, since we can’t elevate a program once it’s already running (that’s the whole point of UAC!).
The user will receive a UAC prompt at this point if Windows is configured to do so.
Yes, there’s a little VBScript in there. Use when necessary.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Elevate credentials&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:warn_and_proceed&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Cannot determine Windows version, proceeding anyway...&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:elevate&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Check for permissions&lt;/span&gt;
&gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%SYSTEMROOT%\system32\cacls.exe&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%SYSTEMROOT%\system32\config\system&quot;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM If error flag set, we do not have admin.&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &apos;%&lt;span class=&quot;token keyword&quot;&gt;errorlevel&lt;/span&gt;%&apos; &lt;span class=&quot;token operator&quot;&gt;NEQ&lt;/span&gt; &apos;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Requesting administrative privileges...&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; UACPrompt&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; gotAdmin &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;


&lt;span class=&quot;token label property&quot;&gt;:UACPrompt&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Set UAC = CreateObject&lt;span class=&quot;token operator&quot;&gt;^&lt;/span&gt;(&lt;span class=&quot;token string&quot;&gt;&quot;Shell.Application&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;^&lt;/span&gt;) &gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; UAC.ShellExecute &lt;span class=&quot;token string&quot;&gt;&quot;%~s0&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;runas&quot;&lt;/span&gt;, &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;  &gt;&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt;

  &quot;%temp%\getadmin.vbs&quot;
  &lt;span class=&quot;token comment&quot;&gt;REM we are done, exiting recursive call&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/B&lt;/span&gt;&lt;/span&gt;

  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;exist&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;del&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; We have admin privileges, proceeding...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Run install commands from the UNC working directory&lt;/h2&gt;
&lt;p&gt;We finally get to the meat of the script. The first line tests whether the package is already installed by querying the registry for its Installer GUID. The rest is just housekeeping.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Run (privileged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; Install Commands
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:prerequisites&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing prerequisites...&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM Install vc80_vcredist_x86 if not already installed&lt;/span&gt;
&gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{710f4c1c-cc18-4c49-8cbf-51240c89a1a2}&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. vc80_vcredist_x86 already installed&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing vc80_vcredist_x86&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc80_vcredist_x86&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, there is one particular part that may throw you off.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc80_vcredist_x86&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What is that &lt;code class=&quot;language-text&quot;&gt;%~dp0&lt;/code&gt; business? This is because the script is meant to be run from a UNC path. Most scripts, when executed, work from the directory where their file is located, or the CWD, depending on how they were launched. When you run a script from &lt;code class=&quot;language-text&quot;&gt;\\server\share&lt;/code&gt; you do not have that luxury. So how do you ensure that you can copy your script anywhere and not have to re-write every reference to every file?
Enter &lt;code class=&quot;language-text&quot;&gt;%~dp0&lt;/code&gt;. That prefix tells &lt;code class=&quot;language-text&quot;&gt;command.com&lt;/code&gt; to use the script’s own path to find the file. In the case of the above command, it would expand it to:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; \\server\share\vc80_vcredist_x86.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Very handy. And odd. But that is the way of batch scripting. Nothing but corner cases. &lt;code class=&quot;language-text&quot;&gt;command.com&lt;/code&gt; must have a lot of corners.&lt;/p&gt;
&lt;h2&gt;All together now&lt;/h2&gt;
&lt;p&gt;Finally, here is the complete script for your reference, slicing and dicing. If you use it, it would make me happy for you to let me know, and perhaps even share your modifications here.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ECHO&lt;/span&gt; OFF&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Elevated credential install script&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Created by Matt Newton&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM 07.17.2012&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM matt@mnewton.com&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM This script checks for Windows OS version and if Vista or 7 is detected&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM then it re-runs itself within a VBS wrapper to elevate the credentials.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM It then runs the :install commands, cleans up temp files, and exits.&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Check Windows Version&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.0\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_2000&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.1\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_XP&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.2\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_2003&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;6\.0\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;6\.1\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_Win7&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; warn_and_proceed&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_Win7&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; elevate&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; elevate&lt;/span&gt;


&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Elevate credentials&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:warn_and_proceed&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Cannott determine Windows version, proceeding anyway...&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:elevate&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Check for permissions&lt;/span&gt;
&gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%SYSTEMROOT%\system32\cacls.exe&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%SYSTEMROOT%\system32\config\system&quot;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM If error flag set, we do not have admin.&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &apos;%&lt;span class=&quot;token keyword&quot;&gt;errorlevel&lt;/span&gt;%&apos; &lt;span class=&quot;token operator&quot;&gt;NEQ&lt;/span&gt; &apos;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Requesting administrative privileges...&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; UACPrompt&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; gotAdmin &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;


&lt;span class=&quot;token label property&quot;&gt;:UACPrompt&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Set UAC = CreateObject&lt;span class=&quot;token operator&quot;&gt;^&lt;/span&gt;(&lt;span class=&quot;token string&quot;&gt;&quot;Shell.Application&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;^&lt;/span&gt;) &gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; UAC.ShellExecute &lt;span class=&quot;token string&quot;&gt;&quot;%~s0&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;runas&quot;&lt;/span&gt;, &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;  &gt;&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt;

  &quot;%temp%\getadmin.vbs&quot;
  &lt;span class=&quot;token comment&quot;&gt;REM we are done, exiting recursive call&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/B&lt;/span&gt;&lt;/span&gt;


&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Identify OS Versions&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_2000&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows &lt;span class=&quot;token number&quot;&gt;2000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; gotAdmin&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_XP&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows XP&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; gotAdmin&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_2003&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows &lt;span class=&quot;token number&quot;&gt;2003&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; gotAdmin&lt;/span&gt;


&lt;span class=&quot;token label property&quot;&gt;:gotAdmin&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;exist&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;del&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; We have admin privileges, proceeding...&lt;/span&gt;


&lt;span class=&quot;token label property&quot;&gt;:install&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Run (privileged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; Install Commands
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:prerequisites&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing prerequisites...&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM Install vc80_vcredist_x86 if not already installed&lt;/span&gt;
&gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{710f4c1c-cc18-4c49-8cbf-51240c89a1a2}&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. vc80_vcredist_x86 already installed&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing vc80_vcredist_x86&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc80_vcredist_x86&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


&lt;span class=&quot;token comment&quot;&gt;REM Install vc90_vcredist_x86 if not already installed&lt;/span&gt;
&gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1F1C2DFC-2D24-3E06-BCB8-725134ADF989}&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. vc90_vcredist_x86 already installed&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing vc90_vcredist_x86&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc90_vcredist_x86&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


&lt;span class=&quot;token comment&quot;&gt;REM Install if on Windows 32 bit&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%processor_architecture%&lt;/span&gt; == x86 (&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;REM Test if Citrix Receiver is installed&lt;/span&gt;
  &gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; dir &lt;span class=&quot;token parameter attr-name&quot;&gt;/s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;C:\Program Files\Citrix\receiver.exe&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Citrix Receiver already installed&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing Citrix Receiver&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; msiexec &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0Receiver&lt;/span&gt;\RIInstaller.msi &lt;span class=&quot;token parameter attr-name&quot;&gt;/passive&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/norestart&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


  &lt;span class=&quot;token comment&quot;&gt;REM Install SSO Plugin if not already installed&lt;/span&gt;
  &gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; dir &lt;span class=&quot;token parameter attr-name&quot;&gt;/s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;c:\Program Files\Citrix\JavaBridge.dll&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; SSO Agent x86 may have the wrong modules, uninstalling&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; msiexec &lt;span class=&quot;token parameter attr-name&quot;&gt;/x&lt;/span&gt; {A0C5486E-58A8-48FB-91ED-53881E019700} &lt;span class=&quot;token parameter attr-name&quot;&gt;/passive&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/norestart&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;

  &lt;span class=&quot;token comment&quot;&gt;REM  %~dp0CitrixSSOPlugin32.exe /silent SYNCPOINTTYPE=FileSyncPath SYNCPOINTLOC=\\server\CITRIXSYNC$ DI_SELECT=1 SSPR_SELECT=1 SERVICEURL=&quot;https://server/MPMService/&quot;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;REM An argument of &quot;/forcerestart&quot; can be added to the end to automatically restart&lt;/span&gt;

  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing Citrix Single Sign-On Plugin &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;.&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;32&lt;/span&gt; bit&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; msiexec &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0SSOPlugin32&lt;/span&gt;\SFPDSSOPlugin32.msi &lt;span class=&quot;token parameter attr-name&quot;&gt;/passive&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/norestart&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


&lt;span class=&quot;token comment&quot;&gt;REM Install if on Windows 64 bit&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%processor_architecture%&lt;/span&gt; == AMD64 (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing x64 prerequisites...&lt;/span&gt;

  &gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{071c9b48-7c32&lt;span class=&quot;token number&quot;&gt;-4621&lt;/span&gt;-a0ac-3f809523288f}&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. vc80_vcredist_x64 already installed&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing vc80_vcredist_x64&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc80_vcredist_x64&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;

  &gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4B6C7001-C7D6&lt;span class=&quot;token number&quot;&gt;-3710&lt;/span&gt;-913E-5BC23FCE91E6}&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. vc90_vcredist_x64 already installed&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing vc90_vcredist_x64&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc90_vcredist_x64&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


  &lt;span class=&quot;token comment&quot;&gt;REM Test if Citrix Receiver is installed&lt;/span&gt;
  &gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; dir &lt;span class=&quot;token parameter attr-name&quot;&gt;/s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;C:\Program Files (x86)\Citrix\receiver.exe&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Citrix Receiver already installed&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. Installing Citrix Receiver&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; msiexec &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0Reciever&lt;/span&gt;\RIInstaller.msi &lt;span class=&quot;token parameter attr-name&quot;&gt;/passive&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/norestart&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


  &lt;span class=&quot;token comment&quot;&gt;REM Install SSO Plugin if not already installed&lt;/span&gt;
  &gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; dir &lt;span class=&quot;token parameter attr-name&quot;&gt;/s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;c:\Program Files (x86)\Citrix\ssoShell.exe&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; SSO Agent x86 is already installed, uninstalling&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; msiexec &lt;span class=&quot;token parameter attr-name&quot;&gt;/x&lt;/span&gt; {FC95142E-AD05-4ECB-9F13-93466D6B5C69} &lt;span class=&quot;token parameter attr-name&quot;&gt;/passive&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/norestart&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;REM  %~dp0CitrixSSOPlugin64.exe /silent SYNCPOINTTYPE=FileSyncPath SYNCPOINTLOC=\\server\CITRIXSYNC$ DI_SELECT=1 SSPR_SELECT=1 SERVICEURL=&quot;https://server/MPMService/&quot;&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;REM An argument of &quot;/forcerestart&quot; can be added to the end to automatically restart&lt;/span&gt;

  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing Citrix Single Sign-On Plugin &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;.&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;64&lt;/span&gt; bit&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; msiexec &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0&lt;/span&gt;\SSOPlugin64\SFPDSSOPlugin64.msi &lt;span class=&quot;token parameter attr-name&quot;&gt;/passive&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/norestart&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  SUCCESS&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;3010&lt;/span&gt; (&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. SUCCESS, reboot required&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;REBOOT_FLAG&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;. ERROR = &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&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;


&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installation complete&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%REBOOT_FLAG%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; You may need to restart the Citrix SSO Plugin manually&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Please press any key to end the install routine&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;pause&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/B&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Please press any key to restart your computer&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;pause&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;shutdown&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Citrix SSO Plugin Install&quot;&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;-t&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Credits&lt;/h2&gt;
&lt;p&gt;Once again, thank you Evan Greene. I used &lt;a href=&quot;http://sites.google.com/site/eneerge/home/BatchGotAdmin&quot;&gt;your UAC script&lt;/a&gt; as a starting point for this one.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Web Apps need more powerful security standard]]></title><description><![CDATA[I’ve been developing a web app that needs access to all sites that a user visits. Somewhat similar to lastpass, it scans pages as the user…]]></description><link>https://blog.mnewton.com/web-apps-need-more-powerful-security-standard/</link><guid isPermaLink="false">https://blog.mnewton.com/web-apps-need-more-powerful-security-standard/</guid><pubDate>Thu, 07 Jun 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I’ve been developing a web app that needs access to all sites that a user visits. Somewhat similar to lastpass, it scans pages as the user browses and fills in information in forms when appropriate.&lt;/p&gt;
&lt;h3&gt;Currently, the only decent way to make such a thing is to put it in a web browser plugin.&lt;/h3&gt;
&lt;p&gt;But what happens when you’re on a work computer, kiosk, or mobile device? You lose the great functionality that you’ve been accustomed to on your computer.&lt;/p&gt;
&lt;h3&gt;You’re worse off than before because now your workflow is dependent on this functionality you don’t have access to.&lt;/h3&gt;
&lt;p&gt;What we need is a secure way to allow a true web app to &lt;em&gt;access other websites data on our behalf, directly from the browser&lt;/em&gt;. CORS is not the answer (&lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-origin_resource_sharing&quot;&gt;http://en.wikipedia.org/wiki/Cross-origin_resource_sharing&lt;/a&gt;) because it relies on each site giving special permission to the web app.&lt;/p&gt;
&lt;p&gt;I’m not the only one who thinks so. Here is a quote from Tim Berners-Lee:&lt;/p&gt;
&lt;h3&gt;“If I can’t give power to apps, then the web app platform cannot compete with native apps.”&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The open web platform is a strong contender&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;for apps which you write once run anywhere
and end up being a better alternative, or quietly
moving out, native apps on all kids of device.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;These apps have got to be able to completely&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;act as agents trusted by the user, like for example&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;a web browser&lt;/li&gt;
&lt;li&gt;a calendar client&lt;/li&gt;
&lt;li&gt;an IMAP client&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;and so on, none of these can you currently write&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;as a web app, because of CORS.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;As a user when I install an app, I want to be able to give&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;it access to a selection of:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Program storage, to a limit&lt;/li&gt;
&lt;li&gt;Whether it is permanently available or downloaded or cached for a while&lt;/li&gt;
&lt;li&gt;Access to RAM at runtime, to a limit&lt;/li&gt;
&lt;li&gt;Access to the net, maybe to a bandwidth limit&lt;/li&gt;
&lt;li&gt;CPU time when in background, to a limit&lt;/li&gt;
&lt;li&gt;Ability to access anything on the web&lt;/li&gt;
&lt;li&gt;Access to its own local storage up to a given limit&lt;/li&gt;
&lt;li&gt;Access to shared local storage up to a given limit&lt;/li&gt;
&lt;li&gt;Access to my location, as we currently allow an origin;&lt;/li&gt;
&lt;li&gt;Access video and still camera, and sound&lt;/li&gt;
&lt;li&gt;Access to other sensors such as temp, accelerometer, etc&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I want to be able to se where all my resources (including CPU, RAM, ‘disk’)  on my laptop or tablet or phone&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;are being used up, just like I do with music and movies.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I want maybe a couple of default profiles for all the above.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;(I’ll want to sync its local and shared data storage between  all my devices too)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;If I can’t give power to apps, then the web app platform cannot compete with native apps.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I don’t want the value of these setting to be the origin domain name of the script of the app,&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;as that is too high a granularity.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that when people talk about installation, they often immediately discuss&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;packaging and manifest formats, which will need to be defined, and for which
we might have more than one, but is not the crux of the issue — the crux is
allowing it access to precious and/or sensitive resources.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Tim&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;source: &lt;a href=&quot;http://lists.w3.org/Archives/Public/public-webapps/2012JanMar/0464.html#start464&quot;&gt;http://lists.w3.org/Archives/Public/public-webapps/2012JanMar/0464.html#start464&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Code Syntax Highlighting in Tumblr]]></title><description><![CDATA[Edited 08/10/2012: See updated post: Add Code Syntax Highlighting to any page in “Two” Lines It aggravates me that no blogging platform…]]></description><link>https://blog.mnewton.com/code-syntax-highlighting-in-tumblr/</link><guid isPermaLink="false">https://blog.mnewton.com/code-syntax-highlighting-in-tumblr/</guid><pubDate>Thu, 24 May 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;Edited 08/10/2012: See updated post: &lt;a href=&quot;/add-code-syntax-highlighting-to-any-page-in-two-lines/&quot;&gt;Add Code Syntax Highlighting to any page in “Two” Lines&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It aggravates me that no blogging platform makes it easy to enable code highlighting. Oh well, at least tumblr makes it easy to edit HTML manually to include code highlighting.&lt;/p&gt;
&lt;p&gt;I put together the code highlighting on this blog using the following two posts as guidelines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://ghoti143.tumblr.com/post/1412901908/google-code-prettify-tumblr-love&quot;&gt;http://ghoti143.tumblr.com/post/1412901908/google-code-prettify-tumblr-love&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify&quot;&gt;http://www.codingthewheel.com/archives/syntax-highlighting-stackoverflow-google-prettify&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both of those posts are great, but I’m a minimalist so I want to make the whole process a bit easier. You can highlight all of your code blocks with one block that you can copy and paste into your html file right before the &lt;code class=&quot;language-text&quot;&gt;&amp;lt;/body&gt;&lt;/code&gt; tag:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- prettify --&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;link&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;href&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;http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;type&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;text/style&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;rel&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;stylesheet&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;script&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;src&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;http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token attr-name&quot;&gt;type&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;text/javascript&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 script&quot;&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;script&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;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;
  &lt;span class=&quot;token selector&quot;&gt;pre.prettyprint&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;overflow-x&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; auto&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5px 20px 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&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;style&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;script&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&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;text/javascript&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 script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
  &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;styleCode&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;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;typeof&lt;/span&gt; disableStyleCode &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;undefined&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;return&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;var&lt;/span&gt; a &lt;span class=&quot;token operator&quot;&gt;=&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 function&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;pre code&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 function&quot;&gt;parent&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 function&quot;&gt;each&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 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;if&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 function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&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;hasClass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;prettyprint&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 function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&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;addClass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;prettyprint&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;
          a &lt;span class=&quot;token operator&quot;&gt;=&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 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;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;a&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;prettyPrint&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;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token function&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 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 function&quot;&gt;styleCode&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;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&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;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- end prettify --&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Windows Versioning and UAC Elevation in a Batch Script]]></title><description><![CDATA[Edited 07/18/2012: See updated post, Windows Installer Batch Script Revisited Recently, I needed to write a script that would install…]]></description><link>https://blog.mnewton.com/windows-versioning-and-uac-elevation-in-a-batch-script/</link><guid isPermaLink="false">https://blog.mnewton.com/windows-versioning-and-uac-elevation-in-a-batch-script/</guid><pubDate>Wed, 23 May 2012 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;Edited 07/18/2012: See updated post, &lt;a href=&quot;/windows-installer-batch-script-revisited/&quot;&gt;Windows Installer Batch Script Revisited&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recently, I needed to write a script that would install multiple independent components onto Windows XP and Windows 7 machines. The Windows 7 machines would be both 32-bit and 64-bit architectures.
The install routine needed to:
Determine which Windows version it was running on
Elevate UAC (User Account Control) on the Windows 7 machines.
Determine which processor architecture it was running on (32 bit or 64 bit)
Run other install routines according to the above findings and report on their success
Run itself and other routintes from a UNC share
It turns out there is no simple way to elevate UAC in a batch file. You have to drop to VBScript. The whole routine is a pain to write in VBScript though, because VBScript is a terrible mess of a language.&lt;/p&gt;
&lt;p&gt;After some searching, I stumbled across this post with a great script by Evan Greene that I used as a starting point:
&lt;a href=&quot;http://sites.google.com/site/eneerge/home/BatchGotAdmin&quot;&gt;http://sites.google.com/site/eneerge/home/BatchGotAdmin&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks Evan!&lt;/p&gt;
&lt;p&gt;I wrapped some additional code around it to determine OS version and processor architecture.&lt;/p&gt;
&lt;p&gt;Check it out:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;batch&quot;&gt;&lt;pre class=&quot;language-batch&quot;&gt;&lt;code class=&quot;language-batch&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ECHO&lt;/span&gt; OFF&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Check Windows Version&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.0\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_2000&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.1\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_XP&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;5\.2\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_2003&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;6\.0\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ver&lt;/span&gt; | findstr &lt;span class=&quot;token parameter attr-name&quot;&gt;/i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;6\.1\.&quot;&lt;/span&gt; &gt; nul&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; goto ver_Win7&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; warn_and_proceed&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_Win7&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows &lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; elevate&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:ver_Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; OS Version: Windows Vista&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; elevate&lt;/span&gt;


&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Elevate credentials&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:elevate&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Check for permissions&lt;/span&gt;
&gt;nul 2&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%SYSTEMROOT%\system32\cacls.exe&quot;&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%SYSTEMROOT%\system32\config\system&quot;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;REM If error flag set, we do not have admin.&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &apos;%&lt;span class=&quot;token keyword&quot;&gt;errorlevel&lt;/span&gt;%&apos; &lt;span class=&quot;token operator&quot;&gt;NEQ&lt;/span&gt; &apos;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&apos;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Requesting administrative privileges...&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; UACPrompt&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;goto&lt;/span&gt; gotAdmin &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;


&lt;span class=&quot;token label property&quot;&gt;:UACPrompt&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Set UAC = CreateObject&lt;span class=&quot;token operator&quot;&gt;^&lt;/span&gt;(&lt;span class=&quot;token string&quot;&gt;&quot;Shell.Application&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;^&lt;/span&gt;) &gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; UAC.ShellExecute &lt;span class=&quot;token string&quot;&gt;&quot;%~s0&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;, &lt;span class=&quot;token string&quot;&gt;&quot;runas&quot;&lt;/span&gt;, &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;  &gt;&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt;

  &quot;%temp%\getadmin.vbs&quot;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/B&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:warn_and_proceed&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Cannot determine Windows version, proceeding anyway...&lt;/span&gt;

&lt;span class=&quot;token label property&quot;&gt;:gotAdmin&lt;/span&gt;
&lt;span class=&quot;token label property&quot;&gt;:ver_2000&lt;/span&gt;
&lt;span class=&quot;token label property&quot;&gt;:ver_XP&lt;/span&gt;
&lt;span class=&quot;token label property&quot;&gt;:ver_2003&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;exist&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;del&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;%temp%\getadmin.vbs&quot;&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; We have admin privileges, proceeding...&lt;/span&gt;


&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM Run privileged commands&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;REM ===========================================================================&lt;/span&gt;

&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Executing install commands&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;token parameter attr-name&quot;&gt;/wait&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%~dp0vc80_vcredist_x86&lt;/span&gt;.exe &lt;span class=&quot;token parameter attr-name&quot;&gt;/q&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  vc_redist_x86 installed successfully&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  ERROR in installing vc_redist_x86&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%processor_architecture%&lt;/span&gt; == x86 (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing &lt;span class=&quot;token number&quot;&gt;32&lt;/span&gt; bit version&lt;/span&gt;
  %~dp0CitrixSSOPlugin32.exe /silent SYNCPOINTTYPE=FileSyncPath  SSPR_SELECT=1
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  Citrix SSO Plugin &lt;span class=&quot;token number&quot;&gt;32&lt;/span&gt;-bit installed successfully&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  ERROR in installing Citrix SSO Plugin &lt;span class=&quot;token number&quot;&gt;32&lt;/span&gt;-bit&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 command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%processor_architecture%&lt;/span&gt; == AMD64 (&lt;/span&gt;
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Installing &lt;span class=&quot;token number&quot;&gt;64&lt;/span&gt; bit version&lt;/span&gt;
  %~dp0vc80_vcredist_x64.exe /q
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  vc_redist_x64 installed successfully&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  ERROR in installing vc_redist_x64&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  %~dp0CitrixSSOPlugin64.exe /silent SYNCPOINTTYPE=FileSyncPath SSPR_SELECT=1
  &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;%ERRORLEVEL%&lt;/span&gt; == &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; (&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  Citrix SSO Plugin &lt;span class=&quot;token number&quot;&gt;64&lt;/span&gt;-bit installed successfully&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt;.  ERROR in installing Citrix SSO Plugin &lt;span class=&quot;token number&quot;&gt;64&lt;/span&gt;-bit&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 command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; Script execution complete&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;echo&lt;/span&gt; You may close this window now.&lt;/span&gt;
&lt;span class=&quot;token command&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;pause&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Hopefully this will help you out.&lt;/p&gt;</content:encoded></item></channel></rss>