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
Neat — it’s available!
The next step was to install it
Install-Package -Name skype -Force -Verbose
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
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.188.8.131.52’ folder.
As a test, I decided to remove this folder and run (Get-Package -Name skype).Status again.
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.
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
It was set to ‘AllSigned’ which explains the issue. I then set it to ‘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 😉