Adding a Code signing Certificate to your Lync Script

I have gotten such fantastic help from the Lync community on tools we need desperately. Unfortunately, I also work for a very Large computer company. Many of my customer sigh as I show them the scripts. Many comment how they wish they were signed with a certificate. Here goes nothing. I am not a programmer by trade so I will start by setting the bar low. As far as I am willing to go is the PowerShell ISE.

 

Start by downloading Sign-ISEScript.ps1 or Bing the ISE Scripting Geek Module. The files you need are located there or on my SkyLive. Open the Powershell ISE and run a single command $profile.

The returned path will be the profile script for your username. It will look like this:

 

C:\Users\luser_name\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 The contents should look like this:

$psISE.Options.OutputPaneBackground = ‘blue’

# psEdit $profile //

set-executionpolicy -executionpolicy Unrestricted

import-module isescriptinggeek

register-objectevent $psise.CurrentPowerShellTab.Files collectionchanged -action {

# iterate ISEFile objects

$event.sender | % {

# set private field which holds default encoding to ASCII

$_.gettype().getfield(“encoding”,“nonpublic,instance”).setvalue($_, [text.encoding]::ascii)

}

}

This includes a fix for a bug in the application. The menu.ps1 goes into the folder

 

C:\Windows\System32\WindowsPowerShell\v1.0\modules is the location where the ISE runs  the script, so when you add the module to the ISE application it gets placed here. The folder name is

Isescriptinggeek. this folder should be place in the modules folder. That is it. you are ready to run your script.  You can manually run this script by running $profile. Place the script in that location, in the modules folder and then run import-module nameoffolder. If you have a profile issue, you may have to create one

 

Windows 7 profile .ps1 is created here- C:\Users\louis_reeves\Documents\WindowsPowerShell

Windows 8 here- C:\Users\luser_name\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

 

This should be enough to get you going. there may be another dependency I may have forgot. The ADD on module may have had to have been added. you can find all you need here at the PowerShell tools center

I think I had installed this first, the ISEPACK2.  If your script get blocked every time you run it, take a look at this article.

 

The ISEPACK, contains a batch file that installs the features you need to add menus to your PowerShell ISE. Once you get the menu working at the top called add-ons, you can run the above module and get your code signing script working.

 

As far as getting the certificate, I always recommend Digicert. They are the best in the business. Their tools will never leave you in a learch. The method to add the certificate is documented as well. the Scripting Guy is the one I used. I did not use a GPO. I just used my local machine. Another article has the shell commands. this is the way I ultimately signed mine. I did have to save them as text files first.

 

This turned out to be a very messy project but I did accomplish the main goal.

 

I hope this helps in some way.

Louis

 

Advertisements

One thought on “Adding a Code signing Certificate to your Lync Script

  1. […] Adding a Code signing Certificate to your Lync Script – […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s