How to re-install Windows PowerShell?


AlterNate37

Member
Member
Local time
8:50 PM
Posts
61
OS
Windows 11 Pro
Hi,

I post this here and not in Apps/Software because this is an integrated function.

Recent events showed that for some unknown reason my Windows PowerShell 5.1 32bit isn't working at all.
SFC says it's all ok.
Chkdsk says it's all ok.
I didn't run DISM RestoreHealth because I'm concerned that it would automatically undo the changes I've made to the system (like some components I removed or features I disabled). But if you tell me that it won't, I would be open to use that.

I've tried installing WMF but Microsoft only offers versions for Win 7, Win 8.1 and something with 12 which I think it's Windows Server.
And when I tried installing them I got the error that it's not for my system.

If you'll confirm that RestoreHealth can undo changes, I wonder if there's maybe a way to get PowerShell with WinGet with some PS script or DISM command?
Or if there is some other DISM repair I can use apart for RestoreHealth to fix this?

Thanx
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s
oracle virtual box is free. just install that and then make the vm on there and pull the files needed
 

My Computer

System One

  • OS
    Windows 11 Pro
Maybe your ACL's are just messed up. Download the text file and run this command:
Code:
icacls /restore C:\Windows\System32 Restore_Perms.txt /t /c
 

Attachments

My Computer

System One

  • OS
    Windows 7
Maybe your ACL's are just messed up. Download the text file and run this command:
Code:
icacls /restore C:\Windows\System32 Restore_Perms.txt /t /c
Do I have to save that txt in the System32 folder?
Or how does that command know where I saved the file?
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s
Before I try Garlin's suggestion:

I tried something, I mounted the ISO from Microsoft and copied the install.wim on my disk and then mounted the index 6 (Windows 11 Pro) with this command:
dism /Mount-Image /ImageFile:"D:\install.wim" /Index:6 /MountDir:D:\Mount

Then I've done this:
robocopy "D:\Mount\Windows\SysWOW64\WindowsPowerShell\v1.0" "C:\Windows\SysWOW64\WindowsPowerShell\v1.0" /E /COPYALL /R:0

But powershell 32bit still doesn't work.
I know that the folder was copied correctly, the command worked (there were errors at first but I took ownership of the folder with full control and it worked). I also can see that after running this command the files in the folder v1.0 have again TrustedInstaller as owner.
So, if there was some corrupted file, this should have recovered it.
And yet, it still doesn't work.

Could it be that there's is some restriction for 32bit stuff on my system?
How can I check that?
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s
No, no restriction for 32bit stuff, CMD 32 bit works and evoking notepad 32bit from CMD 32bit works.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s

My Computer

System One

  • OS
    WinDOS 23H2
    Computer type
    Laptop
    CPU
    Intel & AMD
    Memory
    SO-DIMM SK Hynix 15.8 GB Dual-Channel DDR4-2666 (2 x 8 GB) 1329MHz (19-19-19-43)
    Graphics Card(s)
    nVidia RTX 2060 6GB Mobile GPU (TU106M)
    Sound Card
    Onbord Realtek ALC1220
    Screen Resolution
    1920 x 1080
    Hard Drives
    1x Samsung PM981 NVMe PCIe M.2 512GB / 1x Seagate Expansion ST1000LM035 1TB
You could always go with the latest: PowerShell-7.5.0-win-x64.msi or PowerShell-7.5.0-win-x86.msi (that's both 32bit/x86 and 64bit/x86). Works even as a portable version.

There's also other options - using winget - or more comfortably - UniGetUI
We're talking of Windows PowerShell 32bit not working.
I'm not sure how PowerShell 7.5 (which I already have) would be useful for things which not only are specifically asking for Windows PowerShell (which is working properly) instead of PowerShell 7.5, but they need specifically the 32bit version.
I'm now trying the reset permission thing from Garlin but for the whole Windows folder (I extracted the permissions from a Windows 11 Pro ISO downloaded from Microsoft) because he didn't tell me where to save the file and anyway if I have a problem with the 32bit PowerShell the folder sytem32 isn't the right one.

But I tried restoring permissions for syswow64 and it didn't work, so I'm now making the last attempt and if this rubbish keeps happening I'll try restorehealth and if it undo things which I had changed I will change them again and period.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s
We're talking of Windows PowerShell 32bit not working.
I'm not sure how PowerShell 7.5 (which I already have) would be useful for things which not only are specifically asking for Windows PowerShell (which is working properly) instead of PowerShell 7.5, but they need specifically the 32bit version.
I'm now trying the reset permission thing from Garlin but for the whole Windows folder (I extracted the permissions from a Windows 11 Pro ISO downloaded from Microsoft) because he didn't tell me where to save the file and anyway if I have a problem with the 32bit PowerShell the folder sytem32 isn't the right one.

But I tried restoring permissions for syswow64 and it didn't work, so I'm now making the last attempt and if this rubbish keeps happening I'll try restorehealth and if it undo things which I had changed I will change them again and period.

x86 = 32bit, even PowerShell 7.5 has a 32 bit variant (you probably have only the x64 = 64 bit version installed).

winget is a command line packet manager (made by Microsoft) - useful to install, re-install or upgrade multiple apps. While UniGetUi is a GUI (graphical user interface) - covering multiple software repositories - including winget.

I get what you wanted but you said you made a lot of changes to Windows (and that's probably how you broke it - in the first-place). Otherwise, an in-Place Upgrade would be recommended - solving all kinds of integrated features issues:

 

My Computer

System One

  • OS
    WinDOS 23H2
    Computer type
    Laptop
    CPU
    Intel & AMD
    Memory
    SO-DIMM SK Hynix 15.8 GB Dual-Channel DDR4-2666 (2 x 8 GB) 1329MHz (19-19-19-43)
    Graphics Card(s)
    nVidia RTX 2060 6GB Mobile GPU (TU106M)
    Sound Card
    Onbord Realtek ALC1220
    Screen Resolution
    1920 x 1080
    Hard Drives
    1x Samsung PM981 NVMe PCIe M.2 512GB / 1x Seagate Expansion ST1000LM035 1TB
x86 = 32bit, even PowerShell 7.5 has a 32 bit variant (you probably have only the x64 = 64 bit version installed).

winget is a command line packet manager (made by Microsoft) - useful to install, re-install or upgrade multiple apps. While UniGetUi is a GUI (graphical user interface) - covering multiple software repositories - including winget.
I didn't make "lot" of changes, but whatever.
WinGet for what? Windows Powershell can't be reinstalled.

If you mean using PS7 32 bit instead of Windows Powershell 32bit, I was told by @LesFerch that this is not really possible.
Scripts will keep wanting to use the Windows Powershell.
I also wanted to substitute it with PS7, I'd be happy if it's possible.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s
Your Windows installation is partially corrupted (i.e. 32 bit PowerShell should always be present and working) and there is no standalone installer for PowerShell 5.1 for Windows 11. Those components are part of the OS and may be repaired by running DISM /Online /Cleanup-Image /RestoreHealth and then sfc /scannow and, if that doesn't work, then you would move on to doing In-Place Upgrade (Repair Install) which will keep your apps and data.

I understand that you're hesitant to try those fixes, but, IMO, you should never have Windows in a state where you're afraid to run DISM or do a repair via Windows Update. Those are essential tools for fixing mysterious issues without having to do a complete reinstall and you should be able to confidently run them at any time. If you have certain modifications/removals that those procedure will undo, then you should have a script at the ready to apply those changes. For example, my tool for changing the thumbnail mask would have to be run again after doing a repair.
 
Last edited:

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
Wow. I don't understand how you're leery of following a few basic commands, but feel comfortable to DISM mount an install image, robocopy the contents, and then run as TI. My gut feeling is there's more going on than this PS5 corruption, and it's self-inflicted damage.

I'm going to leave this discussion. If you can't repair it, then backup your personal files and reinstall a clean copy of Windows.
 

My Computer

System One

  • OS
    Windows 7
Your Windows installation is partially corrupted
you should never have Windows in a state where you're afraid to run DISM or do a repair via Windows Update.
If you have certain modifications/removals that those procedure will undo, then you should have a script at the ready to apply those changes.
No, I simply removed Powershell 32bit from the ISO and I forgot I did. I just realized it.
It's absurd that it still appears as a file in that folder.
Honestly, my bad for taking for granted that I only need 64bit stuff, but damn, the time I, we wasted, because seeing that file there didn't make anybody me included think that it actually was some kind of empty shell...

I'm not afraid of DISM in general, I simply am concerned about what restorehealth would do to the changes which have been made if it interprets them as a corruption. And I wouldn't know where to start to get a script to do again all what I want if that should ever happen.
Btw I ended running restorehealth, and it didn't fix that damn powershell.

Wow. I don't understand
I'm going to leave this discussion.
I can see that you don't. Secret: Copilot told me.
Sure, thanks for informing me, have a nice day 😅
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    LG Gram 17Z90Q
    CPU
    12th Gen Intel(R) Core(TM) i7-1260P, 2100 Mhz
    Memory
    16GB LPDDR5 SDRAM
    Graphics Card(s)
    Intel(R) Iris(R) Xe
    Hard Drives
    Crucial T500 1TB + 2TB
    Mouse
    Logitech MX Master 3S
    Internet Speed
    Cable, 1000Mbit/s
Back
Top Bottom