Stop a Powershell Script From Continuously Restarting the Computer
A PowerShell window that often pops up randomly can be quite irritating. But then it's even more frustrating when you don't know what's causing this issue.
In this article, we'll take a look at this strange PowerShell issue in detail, what causes the problem, and all the possible solutions you can implement to fix it.
1. Remove the PowerShell Shortcut From the Startup Folder
Your Windows device has a folder named "Startup folder." All the shortcuts or apps within this folder will run as soon as you boot up your device.
Now, PowerShell will also run on startup if its shortcut is inside this folder. To tackle this issue, remove the PowerShell shortcut from this folder as follows:
- Press Win + R to open the Run command dialog box.
- Type %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp and press Enter.
Locate and delete the PowerShell shortcut from the Startup folder.
2. Disable the PowerShell Startup Status on the Task Manager
This issue might also be caused by the way you've configured a few settings. For example, the PowerShell Startup status might be enabled in the Task Manager.
So, let's check out how you can disable the PowerShell Startup status on the Task Manager:
- Press Ctrl + Shift + Esc to open the Task Manager.
- Navigate to the Startup tab.
- Right-click on the Windows PowerShell option and select Disable. Finally, close the Task Manager and restart your device.
3. Disable the PowerShell Startup Status Using the Autoruns Program
At times, it's hard to tell whether PowerShell is configured to run on startup or not.
In this instance, you can use an incredible tool called Autoruns. This feature helps you identify the apps that run immediately when you switch on your device.
Now, here's how you can use the Autoruns program to tackle this issue:
- Download Autoruns from the Microsoft website.
- Run the program and navigate to the Logon tab.
- Locate PowerShell from the options and then uncheck its box. As an example, the image below shows how you'd do this for the OneDrive app.
Finally, close the Autoruns program and restart your device to save these changes.
4. Restart Your Device in Clean Boot Mode
This PowerShell error might be caused by some corrupted third-party apps on your device. Now, the best solution here is to perform a clean boot. From there, you can remove any suspicious app.
And once you've gotten rid of the problematic app, try downloading it again—but use a safe website this time. However, if you don't want to delete the faulty app, try updating it and see if that helps.
5. Perform a Basic Scan on Your Device
In some cases, this error might be caused by some corrupted system files. To resolve the problem, you can perform a simple scan using the Check Disk (CHKDSK) tool.
So, here's how you can run this scan:
- Press Win + R to open the Run command dialog box.
- Type CMD and press Ctrl + Shift + Enter to open an elevated Command prompt.
- Type the following command and press Enter:
chkdsk C: /f
The C: command represents the letter of your PC's hard drive. So, make sure that this command matches the letter displayed next to your hard drive.
Run the scan and then restart your device to save these changes.
6. Run an Advanced Scan on Your Device
If the Check Disk scan didn't help, then you need to take a different approach. For example, you could now run an advanced scan using the DISM and SFC tools. These two features are helpful when it comes to fixing or replacing faulty system files.
To get started, you'd need to run the DISM tool through these steps:
- Type Task Manager in the Start Menu search bar and select the Best match.
- Click the File tab and select Run new task.
- Type CMD and then check the Create this task with administrative privileges box.
- Press OK to run an elevated Command Prompt.
- Next, type the following command and press Enter to run the DISM scan:
DISM /Online /Cleanup-Image /ScanHealth
When you're done running this command, type the following command and press Enter:
DISM /Online /Cleanup-Image /RestoreHealth
From there, restart your device to save the changes. Next, run an SFC scan through these two steps:
- Open an elevated Command Prompt by following the previous steps.
- Type the following command and press Enter to run an SFC scan:
sfc /scannow
Once the scan is complete, close the Command Prompt window and then restart your device.
7. Run the System Maintenance Troubleshooter
Perhaps this is an issue you can resolve with one of the built-in troubleshooters. In this case, we'll assume that this error is caused by system maintenance problems. So, an easy way out is to use the System Maintenance troubleshooter.
Now, here's how you can run this troubleshooter to resolve the issue:
- Press Win + R to open the Run command dialog box.
- Type msdt.exe -id MaintenanceDiagnostic and press Enter.
- Next click the Advanced option in the System Maintenance troubleshooter window. From there, check the Apply repairs automatically box and click Next.
- Follow the on-screen steps and restart your device when you finish.
8. Update Windows
A simple Windows update might be one of the best solutions to this problem. That's because the latest features could get rid of the system bugs that cause this error. Now, the best part is that this will also take care of other system problems.
So, here's how you can update your device:
- Press Win + I to open the System Settings.
- Click Update & Security and select the Windows Update option.
- Finally, press the Check for updates button on the right and follow the on-screen instructions.
9. Disable the Windows PowerShell Temporarily
If you still can't resolve this problem, then you could consider disabling the Windows PowerShell temporarily. Besides, you can always run your commands using the Command Prompt. And even if the Command Prompt fails, there are lots of other Command Prompt alternatives to try.
Now, here's how you can temporarily disable PowerShell:
- Open the Start Menu search bar and type CMD.
- Right-click on the Command Prompt and select Run as administrator.
- Type the following command and press Enter:
Dism /online /Disable-Feature /FeatureName:"MicrosoftWindowsPowerShellV2Root"
Wait for the process to complete and then restart your device.
In case you want to re-enable PowerShell, here's what you can do:
- Open the Command Prompt as per the previous steps.
- Run the following command and press Enter:
Dism /online /Enable-Feature /FeatureName:"MicrosoftWindowsPowerShellV2Root"
Get Rid of Random PowerShell Pop-Up Messages Easily
PowerShell is a handy tool that you can use for various purposes like automating PC tasks. However, it's unpleasant when a PowerShell window keeps popping up randomly.
So, if PowerShell keeps showing up on your screen randomly, try any of the tips covered.
Source: https://www.makeuseof.com/windows-powershell-pops-up-on-restart-fix/
0 Response to "Stop a Powershell Script From Continuously Restarting the Computer"
Post a Comment