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

<channel>
	<title>code signing &#8211; Carl Webster</title>
	<atom:link href="https://www.carlwebster.com/tag/code-signing/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.carlwebster.com</link>
	<description>The Accidental Citrix Admin - The site for those who find themselves supporting Citrix involuntarily or accidentally</description>
	<lastBuildDate>Thu, 08 Oct 2020 12:13:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
<site xmlns="com-wordpress:feed-additions:1">42228915</site>	<item>
		<title>How To Digitally Sign a Microsoft PowerShell Script with a Third-Party Code Signing Certificate (Update April 4, 2012)</title>
		<link>https://www.carlwebster.com/how-to-digitally-sign-a-microsoft-powershell-script-with-a-third-party-code-signing-certificate/</link>
					<comments>https://www.carlwebster.com/how-to-digitally-sign-a-microsoft-powershell-script-with-a-third-party-code-signing-certificate/#comments</comments>
		
		<dc:creator><![CDATA[Carl Webster]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 20:00:08 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[XenApp]]></category>
		<category><![CDATA[XenApp 5 for Server 2003]]></category>
		<category><![CDATA[XenApp 5 for Server 2008]]></category>
		<category><![CDATA[XenApp 6.0]]></category>
		<category><![CDATA[XenApp 6.5]]></category>
		<category><![CDATA[code signing]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">http://webster.skyrocket.ltd/?p=3705</guid>

					<description><![CDATA[I recently wrote an article on using Microsoft PowerShell to document a Citrix XenApp 6.0 farm.  I am also in the process of finishing up follow-up articles for XenApp 5&#8230;]]></description>
										<content:encoded><![CDATA[<p>I recently wrote an article on using Microsoft PowerShell to document a Citrix XenApp 6.0 farm.  I am also in the process of finishing up follow-up articles for XenApp 5 and XenApp 6.5.  One of the options I wanted to make available is a digitally signed copy of the script used in that article.  As there may be environments where only signed PowerShell scripts are allowed, I want to make signed copies of all my PowerShell scripts available.  I still consider myself a PowerShell rookie, so I wanted to document what I had to go through to sign a PowerShell script.</p>
<p><strong>Update: I now use the Digicert Certificate Utility for Windows to sign all my scripts.</strong></p>
<p><a href="https://www.digicert.com/kb/code-signing/digicert-certificate-utility-to-sign-code.htm" target="_blank" rel="noopener noreferrer">Code Signing with the DigiCert® Certificate Utility for Windows</a></p>
<p>The first thing needed is to request a code signing certificate.  At DigiCert, I clicked on <em>Code Signing Certificates </em>(Figure 1).</p>
<figure id="attachment_20993" aria-describedby="caption-attachment-20993" style="width: 977px" class="wp-caption alignnone"><img fetchpriority="high" decoding="async" class="size-full wp-image-20993" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure001-2.png" alt="Figure 1" width="977" height="438" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure001-2.png 977w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure001-2-530x238.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure001-2-900x403.png 900w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure001-2-768x344.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure001-2-600x269.png 600w" sizes="(max-width: 977px) 100vw, 977px" /><figcaption id="caption-attachment-20993" class="wp-caption-text">Figure 1</figcaption></figure>
<p>I then selected <em>Buy Now</em> (Figure 2).</p>
<figure id="attachment_20995" aria-describedby="caption-attachment-20995" style="width: 746px" class="wp-caption alignnone"><img decoding="async" class="size-full wp-image-20995" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure002-2.png" alt="Figure 2" width="746" height="552" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure002-2.png 746w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure002-2-405x300.png 405w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure002-2-600x444.png 600w" sizes="(max-width: 746px) 100vw, 746px" /><figcaption id="caption-attachment-20995" class="wp-caption-text">Figure 2</figcaption></figure>
<p>I then selected <em>Code Signing Cert, </em>a <em>Validity Period, </em>and clicked <em>Continue</em> (Figure 3).</p>
<figure id="attachment_20996" aria-describedby="caption-attachment-20996" style="width: 746px" class="wp-caption alignnone"><img decoding="async" class="size-full wp-image-20996" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure003-2.png" alt="Figure 3" width="746" height="792" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure003-2.png 746w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure003-2-283x300.png 283w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure003-2-600x637.png 600w" sizes="(max-width: 746px) 100vw, 746px" /><figcaption id="caption-attachment-20996" class="wp-caption-text">Figure 3</figcaption></figure>
<p>Next, I selected <em>Microsoft Authenticode</em> and clicked <em>Continue </em>(Figure 4).</p>
<figure id="attachment_20997" aria-describedby="caption-attachment-20997" style="width: 746px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-20997" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure004-2.png" alt="Figure 4" width="746" height="740" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure004-2.png 746w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure004-2-302x300.png 302w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure004-2-150x150.png 150w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure004-2-100x100.png 100w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure004-2-600x595.png 600w" sizes="auto, (max-width: 746px) 100vw, 746px" /><figcaption id="caption-attachment-20997" class="wp-caption-text">Figure 4</figcaption></figure>
<p>Next, I filled in my <em>Organization Details</em> and clicked <em>Continue</em> (Figure 5).</p>
<figure id="attachment_20998" aria-describedby="caption-attachment-20998" style="width: 759px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-20998" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure005-2.png" alt="Figure 5" width="759" height="540" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure005-2.png 759w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure005-2-422x300.png 422w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure005-2-600x427.png 600w" sizes="auto, (max-width: 759px) 100vw, 759px" /><figcaption id="caption-attachment-20998" class="wp-caption-text">Figure 5</figcaption></figure>
<p>I then filled in my <em>Contact Details</em> and clicked <em>Continue</em> (Figure 6).</p>
<figure id="attachment_20999" aria-describedby="caption-attachment-20999" style="width: 742px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-20999" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure006-2.png" alt="Figure 6" width="742" height="564" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure006-2.png 742w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure006-2-395x300.png 395w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure006-2-600x456.png 600w" sizes="auto, (max-width: 742px) 100vw, 742px" /><figcaption id="caption-attachment-20999" class="wp-caption-text">Figure 6</figcaption></figure>
<p>I removed the Payment step information.  I selected <em>I agree to the Terms of Service above</em> and clicked <em>Complete Order</em> (Figure 7).</p>
<figure id="attachment_21000" aria-describedby="caption-attachment-21000" style="width: 742px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21000" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure007-1.png" alt="Figure 7" width="742" height="548" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure007-1.png 742w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure007-1-406x300.png 406w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure007-1-600x443.png 600w" sizes="auto, (max-width: 742px) 100vw, 742px" /><figcaption id="caption-attachment-21000" class="wp-caption-text">Figure 7</figcaption></figure>
<p>I then received an e-mail from DigiCert Support asking me to verify that I did request a Code Signing Certificate.  After I replied to the e-mail in the affirmative, I received another e-mail with a link to create the code-signing certificate (Figure 8).</p>
<figure id="attachment_21001" aria-describedby="caption-attachment-21001" style="width: 823px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21001" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure008-1.png" alt="Figure 8" width="823" height="285" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure008-1.png 823w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure008-1-530x184.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure008-1-768x266.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure008-1-600x208.png 600w" sizes="auto, (max-width: 823px) 100vw, 823px" /><figcaption id="caption-attachment-21001" class="wp-caption-text">Figure 8</figcaption></figure>
<p>Clicking the link in the e-mail opens my Internet browser with the following popup (Figure 9).  I clicked <em>Yes</em>.</p>
<figure id="attachment_21002" aria-describedby="caption-attachment-21002" style="width: 415px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21002" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure009-1.png" alt="Figure 9" width="415" height="229" /><figcaption id="caption-attachment-21002" class="wp-caption-text">Figure 9</figcaption></figure>
<p>Which then took me to the web site shown in Figure 10.  I then clicked <em>Generate Certificate</em>.</p>
<figure id="attachment_21003" aria-describedby="caption-attachment-21003" style="width: 824px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21003" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure010-1.png" alt="Figure 10" width="824" height="416" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure010-1.png 824w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure010-1-530x268.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure010-1-768x388.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure010-1-600x303.png 600w" sizes="auto, (max-width: 824px) 100vw, 824px" /><figcaption id="caption-attachment-21003" class="wp-caption-text">Figure 10</figcaption></figure>
<p>Which then took me to the web page shown in Figure 11.</p>
<figure id="attachment_21004" aria-describedby="caption-attachment-21004" style="width: 833px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21004" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure011-1.png" alt="Figure 11" width="833" height="299" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure011-1.png 833w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure011-1-530x190.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure011-1-768x276.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure011-1-600x215.png 600w" sizes="auto, (max-width: 833px) 100vw, 833px" /><figcaption id="caption-attachment-21004" class="wp-caption-text">Figure 11</figcaption></figure>
<p>I verified in Internet Explorer that the certificate is installed (Figure 12 and Figure 13).</p>
<figure id="attachment_21005" aria-describedby="caption-attachment-21005" style="width: 509px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21005" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure012-1.png" alt="Figure 12" width="509" height="464" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure012-1.png 509w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure012-1-329x300.png 329w" sizes="auto, (max-width: 509px) 100vw, 509px" /><figcaption id="caption-attachment-21005" class="wp-caption-text">Figure 12</figcaption></figure>
<figure id="attachment_21006" aria-describedby="caption-attachment-21006" style="width: 408px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21006" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure013-1.png" alt="Figure 13" width="408" height="508" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure013-1.png 408w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure013-1-241x300.png 241w" sizes="auto, (max-width: 408px) 100vw, 408px" /><figcaption id="caption-attachment-21006" class="wp-caption-text">Figure 13</figcaption></figure>
<p>On the computer where the Code Signing Certificate was installed, I started a PowerShell session running as Administrator.  Using the information from Don Jones’ <em>Windows PowerShell 2.0 TFM</em> book on page 149, I entered the following PowerShell command (should be one long line):</p>
<pre class="brush: powershell; title: ; notranslate">
Set-AuthenticodeSignature `
&quot;C:\Users\cwebster\Documents\carlwebster.com\Documenting a Citrix XenApp 6 Farm with Microsoft PowerShell\XA6_Inventory_Signed.ps1&quot; `
-TimestampServer &quot;http://timestamp.digicert.com/&quot; @(Get-Childitem cert:\CurrentUser\My -codesigning)&#x5B;0]
</pre>
<p>Which then returns a successful signing (Figure 14).</p>
<figure id="attachment_21009" aria-describedby="caption-attachment-21009" style="width: 985px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21009" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure014-1.png" alt="Figure 14" width="985" height="214" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure014-1.png 985w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure014-1-530x115.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure014-1-900x196.png 900w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure014-1-768x167.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure014-1-600x130.png 600w" sizes="auto, (max-width: 985px) 100vw, 985px" /><figcaption id="caption-attachment-21009" class="wp-caption-text">Figure 14</figcaption></figure>
<p>Opening my script shows the added signature block (Figure 15).</p>
<figure id="attachment_21008" aria-describedby="caption-attachment-21008" style="width: 835px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21008" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure015-1.png" alt="Figure 15" width="835" height="652" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure015-1.png 835w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure015-1-384x300.png 384w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure015-1-768x600.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure015-1-600x469.png 600w" sizes="auto, (max-width: 835px) 100vw, 835px" /><figcaption id="caption-attachment-21008" class="wp-caption-text">Figure 15</figcaption></figure>
<p>To verify the newly signed script, I went to my XenApp 6 server, copied the signed script to the C:\PSScripts folder, started a PowerShell session as Administrator, and changed to the C:\PSScripts folder.  I then set the PowerShell script execution policy to AllSigned (Figure 16).</p>
<figure id="attachment_21011" aria-describedby="caption-attachment-21011" style="width: 947px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21011" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure016-1.png" alt="Figure 16" width="947" height="126" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure016-1.png 947w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure016-1-530x71.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure016-1-900x120.png 900w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure016-1-768x102.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure016-1-600x80.png 600w" sizes="auto, (max-width: 947px) 100vw, 947px" /><figcaption id="caption-attachment-21011" class="wp-caption-text">Figure 16</figcaption></figure>
<p>I then tried to run the original unsigned script (Figure 17).  The script would not run because it is not digitally signed.</p>
<figure id="attachment_21012" aria-describedby="caption-attachment-21012" style="width: 954px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21012" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure017-1.png" alt="Figure 17" width="954" height="142" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure017-1.png 954w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure017-1-530x79.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure017-1-900x134.png 900w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure017-1-768x114.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure017-1-600x89.png 600w" sizes="auto, (max-width: 954px) 100vw, 954px" /><figcaption id="caption-attachment-21012" class="wp-caption-text">Figure 17</figcaption></figure>
<p>I then tried to run the signed script (Figure 18).</p>
<figure id="attachment_21013" aria-describedby="caption-attachment-21013" style="width: 965px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21013" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure018-1.png" alt="Figure 18" width="965" height="106" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure018-1.png 965w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure018-1-530x58.png 530w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure018-1-900x99.png 900w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure018-1-768x84.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure018-1-600x66.png 600w" sizes="auto, (max-width: 965px) 100vw, 965px" /><figcaption id="caption-attachment-21013" class="wp-caption-text">Figure 18</figcaption></figure>
<p>I answered <strong>A</strong> to <em>Always run</em> scripts signed by me (Figure 19) and the script runs successfully.</p>
<figure id="attachment_21014" aria-describedby="caption-attachment-21014" style="width: 988px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21014" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure019-1.png" alt="Figure 19" width="988" height="631" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure019-1.png 988w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure019-1-470x300.png 470w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure019-1-900x575.png 900w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure019-1-768x490.png 768w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure019-1-600x383.png 600w" sizes="auto, (max-width: 988px) 100vw, 988px" /><figcaption id="caption-attachment-21014" class="wp-caption-text">Figure 19</figcaption></figure>
<p>By answering <em>Always run</em> my code signing certificate was installed on the server in the Trusted Publishers store (Figure 20).</p>
<figure id="attachment_21015" aria-describedby="caption-attachment-21015" style="width: 509px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21015" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure020-1.png" alt="Figure 20" width="509" height="464" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure020-1.png 509w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure020-1-329x300.png 329w" sizes="auto, (max-width: 509px) 100vw, 509px" /><figcaption id="caption-attachment-21015" class="wp-caption-text">Figure 20</figcaption></figure>
<p>The next time I run the signed script, the script automatically runs (Figure 21).</p>
<figure id="attachment_21016" aria-describedby="caption-attachment-21016" style="width: 418px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full wp-image-21016" src="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure021-1.png" alt="Figure 21" width="418" height="304" srcset="https://www.carlwebster.com/wp-content/uploads/2011/09/Figure021-1.png 418w, https://www.carlwebster.com/wp-content/uploads/2011/09/Figure021-1-413x300.png 413w" sizes="auto, (max-width: 418px) 100vw, 418px" /><figcaption id="caption-attachment-21016" class="wp-caption-text">Figure 21</figcaption></figure>
<p>What I learned is that digitally signing PowerShell scripts is simple to do.  It is not cheap, but it is simple.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.carlwebster.com/how-to-digitally-sign-a-microsoft-powershell-script-with-a-third-party-code-signing-certificate/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3705</post-id>	</item>
	</channel>
</rss>
