Windows 10: Why does my PowerShell Closes immediately after selecting Run with PowerShell

Discus and support Why does my PowerShell Closes immediately after selecting Run with PowerShell in Windows 10 Software and Apps to solve the problem; I want to run a file using PowerShell but after after selecting Run with PowerShell. PowerShell closes immediately after launching. I couldn't capture... Discussion in 'Windows 10 Software and Apps' started by unknownOL, Feb 21, 2023.

  1. unknownOL Win User

    Why does my PowerShell Closes immediately after selecting Run with PowerShell


    I want to run a file using PowerShell but after after selecting Run with PowerShell. PowerShell closes immediately after launching. I couldn't capture the error message.

    :)
     
    unknownOL, Feb 21, 2023
    #1
  2. DK__00 Win User

    Powershell Closing Immediately

    I've looked all of the the internet and I cannot find any information that applies to this situation.

    Powershell closes immediately upon starting. When I run it in Command Prompt I get the following:

    Windows PowerShell terminated with the following error:

    Unable to cast object of type 'System.String' to type 'System.String[]'.

    I have checked the following folders and no profiles exist:

    c:\users\me\appdata\microsoft\windows\powershell

    c:\windows\system32\windowspowershell\v1.0\ c:\windows\systwow64\windowspowershell\v1.0\

    I have tried to run with the following commands and have no luck:

    powershell -noclose

    powershell -noprofile

    I have run the following commands and have no luck:

    sfc.exe /scannow

    DISM.exe /Online /Cleanup-image /Restorehealth

    I also have went to:

    Control Panel -> Uninstall a Program -> Turn Windows features on or off then,

    Removed Powershell, rebooted, then re-installed it.

    After doing all of these steps I still am not able to run Powershell.
     
    DK__00, Feb 21, 2023
    #2
  3. SS-WQY Win User
    PowerShell closes immediately

    hi Rivgil,

    Thank you very much for your reply. I appreciate it.

    I tried to disable and reenable the PowerShell but it didn't work.

    I also opened the link you provided, but I think it's not the issue I have. On my side, PowerShell is not stopped working, it's opened but closed immediately.

    I also tried to open PowerShell on command prompt with admin mode by running the command 'powershell /', which gives me an error - A failure
    occurred during initialization: The type initializer for 'System.Management.Automation.LanguagePrimitives' threw an exception.
     
    SS-WQY, Feb 21, 2023
    #3
  4. Rivgil Win User

    Why does my PowerShell Closes immediately after selecting Run with PowerShell

    PowerShell closes immediately

    Hi, this is . An independent advisor. Sorry if this may caused any trouble. I'll be more than willing to help. We'll try to disable and re-enable the PowerShell.

    Press on Win+X keys and select Control Panel.

    From Control Panel switch to category.

    And from the list that’s displayed choose Uninstall – located under Programs.

    From the left panel of the main window click on the ‘Turn Windows features on or off’ link.

    Scroll down and locate the Windows PowerShell entry.

    Uncheck the PowerShell feature.

    Save and apply your changes.

    Restart your Windows 10 computer.

    Afterwards, repeat the steps from above and re-enable the Windows PowerShell feature.

    If that didn't work, you can try some other steps in this link
    https://windowsreport.com/windows-powershell-st...


    Note: The link provided is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any
    product advertised on the site before you decide to download and install it.

    Let me know how it goes.

    Regards,
     
    Rivgil, Feb 21, 2023
    #4
Thema:

Why does my PowerShell Closes immediately after selecting Run with PowerShell

Loading...
  1. Why does my PowerShell Closes immediately after selecting Run with PowerShell - Similar Threads - Why does PowerShell

  2. PowerShell closes immediately upon startup, even when running ISE or as an Admin.

    in Windows 10 Gaming
    PowerShell closes immediately upon startup, even when running ISE or as an Admin.: I've tried many many things to get Powershell to work, such as:Turning PowerShell on and off in optional features and restarting.System maintenance.powershell -noexitpowershell -noprofileDISM.exe /Online /Cleanup-image /Restorehealth followed by sfc.exe /scannow.Removing...
  3. PowerShell closes immediately upon startup, even when running ISE or as an Admin.

    in Windows 10 Software and Apps
    PowerShell closes immediately upon startup, even when running ISE or as an Admin.: I've tried many many things to get Powershell to work, such as:Turning PowerShell on and off in optional features and restarting.System maintenance.powershell -noexitpowershell -noprofileDISM.exe /Online /Cleanup-image /Restorehealth followed by sfc.exe /scannow.Removing...
  4. PowerShell closes immediately upon startup, even when running ISE or as an Admin.

    in Windows 10 BSOD Crashes and Debugging
    PowerShell closes immediately upon startup, even when running ISE or as an Admin.: I've tried many many things to get Powershell to work, such as:Turning PowerShell on and off in optional features and restarting.System maintenance.powershell -noexitpowershell -noprofileDISM.exe /Online /Cleanup-image /Restorehealth followed by sfc.exe /scannow.Removing...
  5. CMD and PowerShell Closing after a couple of seconds, CMD and Powershell closing.

    in Windows 10 Gaming
    CMD and PowerShell Closing after a couple of seconds, CMD and Powershell closing.: My Laptop is fine i didnt download any viruses, Didnt mess with system files nor modify it. After a normal restart, A message that pops up for half a second saying "This app wont work on this computer" Or something like that The messages appears and disappears too fast its...
  6. CMD and PowerShell Closing after a couple of seconds, CMD and Powershell closing.

    in Windows 10 Software and Apps
    CMD and PowerShell Closing after a couple of seconds, CMD and Powershell closing.: My Laptop is fine i didnt download any viruses, Didnt mess with system files nor modify it. After a normal restart, A message that pops up for half a second saying "This app wont work on this computer" Or something like that The messages appears and disappears too fast its...
  7. CMD and PowerShell Closing after a couple of seconds, CMD and Powershell closing.

    in Windows 10 Customization
    CMD and PowerShell Closing after a couple of seconds, CMD and Powershell closing.: My Laptop is fine i didnt download any viruses, Didnt mess with system files nor modify it. After a normal restart, A message that pops up for half a second saying "This app wont work on this computer" Or something like that The messages appears and disappears too fast its...
  8. Why does my PowerShell Closes immediately after selecting Run with PowerShell

    in Windows 10 Gaming
    Why does my PowerShell Closes immediately after selecting Run with PowerShell: I want to run a file using PowerShell but after after selecting Run with PowerShell. PowerShell closes immediately after launching. I couldn't capture the error message....
  9. Powershell Closing Immediately

    in Windows 10 BSOD Crashes and Debugging
    Powershell Closing Immediately: I've looked all of the the internet and I cannot find any information that applies to this situation. Powershell closes immediately upon starting. When I run it in Command Prompt I get the following: Windows PowerShell terminated with the following error: Unable to...
  10. PowerShell closes immediately

    in Windows 10 BSOD Crashes and Debugging
    PowerShell closes immediately: I am simply trying to open PowerShell and the application closes instantly. This happens when I try opening it as an Admin. I tried input command 'powershell /' on command prompt in admin mode. it gives me an error: The shell cannot be started. A failure occurred during...