‘Issue’ with PowerShell PackageManagement

The other day I had to reformat my computer. When I was thinking of all of the software that I needed to install, I had a great idea to try out this new PackageManagement PowerShell module I’ve heard so much about (formerly known as OneGet).

I made my list of software which included things like Packer, Vagrant, Git, VirtualBox, and so on.  I realized that pretty much everything I wanted needs to come from the Chocolatey provider.

So I checked out the repository to see what was available. I thought I would install Skype first


Find-Package -Name skype

skype

Neat — it’s available!

The next step was to install it


Install-Package -Name skype -Force -Verbose

install

Looks like it worked!

But then I tried to launch it. I used Windows search; nothing there. I looked in add/remove programs; nothing. Program Files? Nope.

That’s weird I thought — so I ran the command


(Get-Package -Name skype).Status

installed

Then I started poking around a bit and I realized why it thinks it is installed. I looked in C:\Chocolatey\lib and I found a ‘skype.7.26.0.101’ folder.

As a test, I decided to remove this folder and run (Get-Package -Name skype).Status again.

missing

The existence of those files makes PackageManagement think Skype is installed, which is pretty stupid.

Anyways, I ran the install command again and the exact same thing happened. I then decided to look inside that folder a bit more.

folder

I quickly discovered something that I’m sure all users of Chocolatey already know — it just downloads a PowerShell script which does the install.

Well, that might explain the issue. I checked my PowerShell Execution Policy


Get-ExecutionPolicy

It was set to ‘AllSigned’ which explains the issue. I then set it to ‘RemoteSigned’


Set-ExecutionPolicy RemoteSigned

I then deleted the Skype folder from lib (otherwise PackageManagement will think it’s already installed) and re-ran the install command.

Sure enough, it worked!

TL;DR: If you are going to be using the Chocolatey provider with PackageManagement, check your Execution Policy 😉

One thought on “‘Issue’ with PowerShell PackageManagement

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