Warning: session_start(): Cannot start session when headers already sent in /home/findtuup/gotechhero.com/wp-content/plugins/jnews-social-login/class.jnews-social-login.php on line 83
{Fixed} Failed to initialize the PowerShell host while installing packages
GoTechHero
  • Home
  • Blog
  • Advertise
  • Contact
  • Store
No Result
View All Result
GoTechHero
  • Home
  • Blog
  • Advertise
  • Contact
  • Store
No Result
View All Result
GoTechHero
No Result
View All Result

Failed to initialize the PowerShell host while installing packages Fixed

by Deepak Mishra
in Coding, Technology
4 min read
0
Share on FacebookShare on TwitterPin Us

This is a quick solution guide to the error- Failed to initialize the PowerShell host while installing packages.

Yes, if you’re a Visual Studio 2019 user then you might come across this error while creating a new project or adding a package using the Nuget package manager. The error popup will look something like below-

Failed to initialize the PowerShell host while installing packages
Error Message

When Failed to initialize the PowerShell host while installing packages Error Appears

There are a couple of places when such error can come-

  • While creating a new project in visual studio
  • While adding a new package using Nuget package

While I received this error while creating a new project, many users received it while installing the NEST Nuget package. People have received the error like-

Error Message

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.

Fix to Failed to initialize the PowerShell host while installing packages

I tried different solution looking at the internet starting with the below-

Solution-1 [Didn’t work]- updating the execution policy by executing the following in a PowerShell opened as Administrator

start-job { Set-ExecutionPolicy Unrestricted } -RunAs32 | wait-job | Receive-Job

But this didn’t work and received the below error-

Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a
more specific scope. Due to the override, your shell will retain its current effective execution policy of
RemoteSigned. Type “Get-ExecutionPolicy -List” to view your execution policy settings. For more information please see
“Get-Help Set-ExecutionPolicy”.
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
+ FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

Solution-2 [Didn’t Work]

Further I tried to set it to RemoteSigned instead of Unrestricted by executing the below code-

start-job { Set-ExecutionPolicy RemoteSigned } -RunAs32 | wait-job | Receive-Jobb

Although this code didn’t give any error and executed successfully but the issue didn’t get resolve. I restarted Visual Studio but the issue was there itself.

Solution-3 [Worked]

When the above 2 solutions didn’t work for me, started looking for alternate and finally found this one which worked. Here I reinstalled Nuget Package manager for Visual Studio using the below steps and it worked.

  1. In Tools -> Extensions and Updates, uninstall NuGet Package Manager for Visual Studio
  2. Restart Visual Studio
  3. In Tools -> Extensions and Updates, install NuGet Package Manager for Visual Studio
  4. Restart Visual Studio

That’s all!

After this I was able to install JSON.NET package as well other then creating the projects in visual studio.

Final Words

This was all about how to fix Failed to initialize the PowerShell host while installing packages in Visual Studio. The solution is pretty simple and if you’re facing this issue too, please follow the same. For more articles, keep visiting GoTechHero.

Tags: .NETC#ErrorVisual Studio
Previous Post

Opera Mini Handler Tricks

Next Post

Best Grammarly Alternatives

Deepak Mishra

Deepak Mishra

Deepak is a Digital Marketing Consultant and a professional blogger working full time since last 7 years. He has worked for various startups and scaled them using internet marketing. At GoTechHero, he is sharing his experience.

Next Post
Best Grammarly Alternatives

Best Grammarly Alternatives

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

Best Grammarly Alternatives

Best Grammarly Alternatives

Failed to initialize the PowerShell host while installing packages

Failed to initialize the PowerShell host while installing packages Fixed

Opera Mini handler tricks

Opera Mini Handler Tricks

How To Block/Skip Hulu Ads [5 Working Ways]

How To Block/Skip Hulu Ads [5 Working Ways]

Best iOS Emulators for Windows 10 PC

6 Best iOS Emulators for Windows 10

Cheap WordPress Hosting Provider in 2020

Top 3 Cheap & Best WordPress Hosting Provider in 2020

GoTechHero

GoTechHero is a Technology & Business blog providing some great information in the niches. We write detailed content and videos to help the community for free.

We also provide many services like blog management, content marketing and guest posting. Please get in touch as needed.

Trending Stories

  • All
  • Tools & Apps
  • Make Money Online
  • Deepak Mishra
Business

Best Grammarly Alternatives

Coding

Failed to initialize the PowerShell host while installing packages Fixed

Stay Connected

  • About Us
  • Privacy Policy
  • Contact
  • Advertise

© 2020 GoTechHero

No Result
View All Result
  • Home
  • Blog
  • Advertise
  • Contact
  • Store

© 2020 GoTechHero

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In