Today i recieved the following Nuget Error while trying to install Automapper.

Failed to initialize the PowerShell host. If your PowerShell execution policy setting is set to AllSigned, open the Package Manager Console to initialize the host first.

To fix that, close all Visual Studio instances and open the Powershell Console as Administrator. Enter Set-ExecutionPolicy RemoteSigned or Set-ExecutionPolicy Unrestricted. Be aware that you need to set the execution policy on both the x86 and the x64 Powershell Console.

A more simple solution would be to put the code below in a File with an .reg extension and execute that.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
"ExecutionPolicy"="Unrestricted"


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
"ExecutionPolicy"="Unrestricted"

Now start Visual Studio and Try Again, if the error appears again, try running Visual Studio as Administrator.

One thought on “NuGet: Failed to initialize the PowerShell Host”

Leave a Reply