Что такое оболочка windows powershell

On one of my client’s server running Windows Server 2012 R2, when you launched PowerShell it would immediately crash with the error:

and this would create windows events non-stop on the server as follows:

At first you think you have the famous PowerShell Virus (Poweliks) but after downloading the Symantec tool and running it, all was clean.

Second thing you try and do is patch windows. Running the latest CU for the server made no difference.

Running SFC /Scannow came back with “no integrity errors found”, so the operating system seemed okay.

Lastly, downloading Windows Management Framework and installing it resolved the issue with PowerShell.

The application launched fine with no more crashing.

Hope it helps.

Skip to content

При попытке установить любой пакет через NuGet в Visual Studio 2013 (VS 2013) получаю сообщение об ошибке:

Install failed. Rolling back…
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.

При попытке вызвать консоль в VS 2013 — View — Other Windows — Package Manager Console так же получаю сообщение об ошибке:

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 Unrestricted. Type «Get-ExecutionPolicy -List» to view your execution policy settings. For more information please see «Get-Help Set-ExecutionPolicy».

В групповой политике (gpedit.msc) выставлены настройки

image

image

SNAGHTML12f871

И всё равно, при попытке в Power Shell Console выставить нужные политики, с помощью Set-ExecutionPolicy AllSigned — получаю сообщение об ошибке:

Set-ExecutionPolicy : Оболочка Windows PowerShell успешно обновила вашу политику выполнения, но данный параметр переопределяется политикой, определенной в более конкретной области. В связи с переопределением оболочка сохранит текущую политику выполнения «Unrestricted». Для просмотра параметров политики выполнения введите «Get-ExecutionPolicy -List». Для получения дополнительных сведений введите «Get-Help Set-ExecutionPolicy».
строка:1 знак:1
+ Set-ExecutionPolicy AllSigned
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
+ FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

SNAGHTML185956

РЕШЕНИЕ: Мне помогло, установка параметра реестра ExecutionPolicy = Bypass в разделе HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell

на всякий случай установил такое же значение еще и здесь

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell

После этого консоль в Visual Studio и NuGet заработали.

А политики стали такими:

image

PowerShell is a reliable tool that you can use to automate and manage your PC tasks. However, this tool often fails and pops up the “PowerShell has stopped working” error.

In most cases, this error stems from faulty system files or corrupted third-party apps. As such, let’s check out how you can easily fix PowerShell if it goes unresponsive often.

1. Enable the Windows PowerShell

This error might pop up simply because the Windows PowerShell is disabled. So, you can tackle the issue by tweaking a few settings as follows:

  1. Type Turn Windows Features on or off in the Start Menu search bar and select the Best match.
  2. Locate the Windows PowerShell option and click its drop-down menu.
  3. Check all the Windows PowerShell boxes, press OK, and then close the Windows Features screen. Finally, restart your device to apply these changes.
Enabling the Windows PowerShell

2. Run the Windows PowerShell With Administrative Privileges

Opening the Windows PowerShell with administrative privileges might help. So, let’s check out how you can do this:

  1. Type Task Manager in the Start Menu search bar and select the Best match.
  2. Click the File tab in the top-left corner and select the Run new task option.
  3. Type Powershell and check the Create this task with administrative privileges box. Finally, click OK to open an elevated PowerShell window.
Running the Windows PowerShell With Administrative Privileges

3. Try Using a Different Microsoft Account

In some instances, this issue might only be affecting the account you’re currently using. So, the best way to tackle the issue is to use a different Microsoft account. If you don’t have a Microsoft account, you might just consider creating it to check if this resolves the issue.

Now, here’s how you can create or sign in to a Microsoft account on Windows:

  1. Click the Windows key and select the Settings option.
  2. Select Accounts and then click Email & accounts on the left-hand side.
  3. Click Add a Microsoft account on the right-hand side and fill in your details.
Signing in With a Microsoft Account

Follow the on-screen instructions and then try open the PowerShell tool.

If the issue persists, then you’re likely dealing with system issues. In this case, we’ll show you how you can resolve the problem.

4. Get Rid of Suspicious Third-Party Programs

Throwing trash in a bin

Some faulty third-party apps might be the ones responsible for this error. However, you might find it difficult to locate the corrupted app that’s causing this issue. In this case, performing a clean boot will help you out.

Once you find the faulty app, you could either update it or completely get rid of it. And if you decide to delete the problematic app, use a reliable third-party uninstaller. This will help get rid of the residual files that might remain and cause other issues.

5. Try the Built-In Troubleshooters

There are a couple of built-in troubleshooters that you can use in various situations. If we assume that this error is caused by system maintenance issues, then the System Maintenance troubleshooter could help.

So, let’s check out how you can run this troubleshooter to tackle the issue at hand:

  1. Type Control Panel in the Start Menu search bar and select the Best match.
  2. Click the View by drop-down menu and select Small icons.
  3. Click Troubleshooting from the menu items. Next, scroll down and select the System and Security option.
  4. Click the System Maintenance option.
  5. Next, click Advanced and then check the Apply repairs automatically box.
  6. Finally, press Next and follow the on-screen steps.
Running the System Maintenance Troubleshooter on Windows

If the issue persists, then we should take a different approach. Since this might be a hardware-related problem, let’s see how the Hardware and Devices troubleshooter could help:

  1. Press Win + I to open the System Settings.
  2. Select Update & Security and then click Troubleshoot on the left-hand side.
  3. Locate and click on the Hardware and Devices troubleshooter. Finally, press the Run the troubleshooter button and follow the on-screen steps.
Running the Hardware and Devices Troubleshooter

6. Perform a System Scan

Computer Security scanner illustration

This error could be caused by faulty system files. In this case, you’d need to perform a system scan and repair those problematic files.

And when it comes to scanning and repairing system files, you can always rely on the Check Disk, DISM, and SFC tools.

Now, let’s get started and check how you can run a Check Disk scan:

  1. Open the Start Menu search bar and type Command Prompt.
  2. Right-click on the Command Prompt option and select Run as administrator.
  3. Type the following command and press Enter to run a Check Disk scan:
        chkdsk C: /f
    

Replace the C: command with the correct drive letter if your Windows OS is installed on a different drive.

After running this scan, follow these steps to run the DISM tool:

  1. Open an elevated Command Prompt by following the previous steps.
  2. Type the following command and press Enter:
        DISM /Online /Cleanup-Image /ScanHealth
    

From there, type the command below and press Enter:

        DISM /Online /Cleanup-Image /RestoreHealth
    

Restart your device once the scan is complete. Now, run an SFC scan through these steps:

  1. Open an elevated Command Prompt as per the previous steps.
  2. Type the following command and press Enter:
        sfc /scannow
    

Wait for the SFC scan to complete and then restart your device.

7. Restore Your Windows Device

Wrenches on a PC

Restoring your device with the System Restore tool could also help. The System Restore feature helps undo any recent changes that might be causing system errors. So, this might also get rid of the bugs that are interfering with PowerShell.

Now, here’s how you can use the System Restore tool to tackle this issue:

  1. Type Control Panel in the Start Menu search bar and select the Best match.
  2. Click the View by drop-down menu and select Small icons.
  3. Scroll down and select the Recovery option. Now, click the Open System Restore option and click Next to continue.
  4. Select a restore point from the options, press Next, and then follow the on-screen steps.
Using a Restore Point on Windows

8. Reset the Device to Its Factory Settings

As a last resort, resetting Windows to its factory settings could help. But before you proceed, keep your data safe by backing up your device.

Now, here’s how you can reset your Windows device:

  1. Press Win + I to open the System Settings.
  2. Click Update & Security and then select Recovery on the left.
  3. Finally, press the Get started button on the right and follow the on-screen instructions.
Resetting a Windows computer

Automate Your Favorite Tasks With the Windows PowerShell

The “PowerShell has stopped working” error can be quite annoying—especially if you don’t know what’s causing it. Fortunately, the methods we’ve covered should help you easily get rid of this error.

POCO, ACE, Loki и другие продвинутые C++ библиотеки

NullReferenced 13.05.2025

В C++ разработки существует такое обилие библиотек, что порой кажется, будто ты заблудился в дремучем лесу. И среди этого многообразия POCO (Portable Components) – как маяк для тех, кто ищет. . .

Паттерны проектирования GoF на C#

UnmanagedCoder 13.05.2025

Вы наверняка сталкивались с ситуациями, когда код разрастается до неприличных размеров, а его поддержка становится настоящим испытанием. Именно в такие моменты на помощь приходят паттерны Gang of. . .

Создаем CLI приложение на Python с Prompt Toolkit

py-thonny 13.05.2025

Современные командные интерфейсы давно перестали быть черно-белыми текстовыми программами, которые многие помнят по старым операционным системам. CLI сегодня – это мощные, интуитивные и даже. . .

Конвейеры ETL с Apache Airflow и Python

AI_Generated 13.05.2025

ETL-конвейеры – это набор процессов, отвечающих за извлечение данных из различных источников (Extract), их преобразование в нужный формат (Transform) и загрузку в целевое хранилище (Load). . . .

Выполнение асинхронных задач в Python с asyncio

py-thonny 12.05.2025

Современный мир программирования похож на оживлённый мегаполис – тысячи процессов одновременно требуют внимания, ресурсов и времени. В этих джунглях операций возникают ситуации, когда программа. . .

Работа с gRPC сервисами на C#

UnmanagedCoder 12.05.2025

gRPC (Google Remote Procedure Call) — открытый высокопроизводительный RPC-фреймворк, изначально разработанный компанией Google. Он отличается от традиционых REST-сервисов как минимум тем, что. . .

CQRS (Command Query Responsibility Segregation) на Java

Javaican 12.05.2025

CQRS — Command Query Responsibility Segregation, или разделение ответственности команд и запросов. Суть этого архитектурного паттерна проста: операции чтения данных (запросы) отделяются от операций. . .

Шаблоны и приёмы реализации DDD на C#

stackOverflow 12.05.2025

Когда я впервые погрузился в мир Domain-Driven Design, мне показалось, что это очередная модная методология, которая скоро канет в лету. Однако годы практики убедили меня в обратном. DDD — не просто. . .

Исследование рантаймов контейнеров Docker, containerd и rkt

Mr. Docker 11.05.2025

Когда мы говорим о контейнерных рантаймах, мы обсуждаем программные компоненты, отвечающие за исполнение контейнеризованных приложений. Это тот слой, который берет образ контейнера и превращает его в. . .

Micronaut и GraalVM — будущее микросервисов на Java?

Javaican 11.05.2025

Облачные вычисления безжалостно обнажили ахиллесову пяту Java — прожорливость к ресурсам и медлительный старт приложений. Традиционные фреймворки, годами радовавшие корпоративных разработчиков своей. . .

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Настройка ipv6 вручную windows 10
  • Что делать если компьютер выдает ошибку при запуске windows 10
  • Перезапустить службу сети windows
  • Как менять экраны в windows 10 горячие клавиши
  • Администрирование в сетях с операционными системами типа windows