PowerShell issue prevents running WinSetView


Hold down the alt key when you click OK in the Submit dialog. That will keep the console open and hopefully there will be an error message.
Tried already but it doesn't keep the console open in my case.
You can run powershell as admin and run:
Code:
set-executionpolicy -executionpolicy unrestricted
I had already tried a similar code and also set the Gpedit policy about turning on script execution (both in the User and the Computer views).
I even turned off Defender's script scanning. Then I#ve tried turning off Defender completely.
Nothing works.

Here the result of running your code:
set-executionpolicy : 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.


And when I've run Get-ExecutionPolicy -List after that:
Scope ExecutionPolicy
----- ---------------
MachinePolicy RemoteSigned
UserPolicy RemoteSigned
Process Undefined
CurrentUser RemoteSigned
LocalMachine Unrestricted
 

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
You set a GPO or modified the registry for executionpolicy. Disable that then run the command again
 

My Computer

System One

  • OS
    Windows 11 Pro
You set a GPO or modified the registry for executionpolicy. Disable that then run the command again
Done. I've reset the permissions so that they all are "undefined", and I've run your code.It only affects LocalMachine.
There's no difference, WinSetView still does nothing, the console doesn't stay with alt+enter.

But I've noticed something.
After using Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force and Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force from the PowerShell (admin) in Win+X, and setting the two script execution entries in Gpedit again in Unrestricted (which correspond to MachinePolicy and UserPolicy), when I get the list of execution policy from the PowerShell (admin) in the Win+X menu, it gives me:
MachinePolicy Unrestricted
UserPolicy Unrestricted
Process Undefined
CurrentUser Unrestricted
LocalMachine Unrestricted

But if I open a PowerShell (admin) from the context menu in the folder where WinSetView.exe is (on the desktop), and I do the same, it gives me:
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Unrestricted
LocalMachine Unrestricted

It's like it's on a separate reality.
Anyway, by using Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force and Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force and even Set-ExecutionPolicy Unrestricted -Scope Process -Force in the PowerShell triggered within the WinSetView.exe folder, and having (verified) the three of them registered as Unrestricted, it still doesn't work. Console still doesn't stay open with Alt+Enter, and nothing happens in the system.

Maybe this last piece of info give your all an idea of what might be wrong here?
I even tried reinstalling PowerShell, but nothing changed.

The only thing I could still try if someone tells me how to forcibly stop the Defender Antivirus and Defender Core services before submitting.
Maybe that's blocking this.
But WHY should it?! I never told it to.
And yet, if not this, I've no idea what else it can be.
 

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
In spite of the fact that Windows 11 is 64-bit, WinSetView uses the 32-bit version of PowerShell 5.1, i.e.,
%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe thereby causing any changes you make in the execution policy settings of 64-bit PowerShell to not apply to WinSetView.

This is because each version [of PowerShell 5.1] has its own registry hive where these policies are stored. As a result, changes made to the execution policy in one version do not affect the other. On 64-bit Windows, the 64-bit version of PowerShell 5.1 is:
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
WinSetView runs as a 32 bit app in order to be as compatible with as many machines as possible with a single executable. In the future, I plan to rewrite it in C# which will allow for a single exe that runs 32 bit or 64 bit automatically. Making it 32 bit was extra work and trouble for me (e.g. ensuring that the registry values it sets are not redirected to the 32 bit registry) but this is the first time I know of that it's caused an end-user complication.

On Windows when some issue appears to make absolutely no sense, it's often a bitness problem. Thanks to @hdmi for getting us on the right track here.
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
In spite of the fact that Windows 11 is 64-bit, WinSetView uses the 32-bit version of PowerShell 5.1, i.e.,
Even more confusing for the less tech-savvy that wow64 is about 32bit but system32 is about 64bit. Wtf, seriously, that's why Windows is a mess, because IT people lack common sense and usability sense.
It's not by chance that it was someone from Apple and not from Microsoft, who invented UX Design.
On Windows when some issue appears to make absolutely no sense, it's often a bitness problem. Thanks to @hdmi for getting us on the right track here.
And does that tell you something about how to solve my issue?

I went to the extreme to start in safe mode and manually deactivate all Defender's functions from the registry. Now Microsoft Defender Antivirus Service, which was in automatic and with no possibility to change its startup status or even only temporarily stop it, is deactivated.
Only Defender Core Service is still in automatic and running. No idea where to find the registry settings to put that down too.
If it's not Defender, what else can be preventing my system from running PS scripts and how do I change it?
Or is it a matter of setting the 32 bit PS in "unrestricted" (which btw, isn't enough in "remotesigned"?)? And how do I do that?


Ok, I've maybe found the issue.
Powershell 5.1 32 bit doesn't even start. I went to C:\Windows\SysWOW64\WindowsPowerShell\v1.0 and double clicked powershell.exe, but there's just some quick flicker like if a window was open and closed within half a second. And ultimately it doesn't start.
 

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
Ok, I've maybe found the issue.
Powershell 5.1 32 bit doesn't even start. I went to C:\Windows\SysWOW64\WindowsPowerShell\v1.0 and double clicked powershell.exe, but there's just some quick flicker like if a window was open and closed within half a second. And ultimately it doesn't start.
Now to determine why it doesn't run. I would think if it's a policy, there would be a message, but not 100% sure about that. It seems more like something corrupted, but I think you already tried dism and sfc, IIRC. If so, I would try a repair via Windows Update:

 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
Now to determine why it doesn't run. I would think if it's a policy, there would be a message, but not 100% sure about that. It seems more like something corrupted, but I think you already tried dism and sfc, IIRC. If so, I would try a repair via Windows Update:
I did try sfc, I didn't try DISM for fear that the restorehealth might put back things which I removed and reverts changes I've made.
If that's not the case, I'd be willing to try DISM.

I'm trying to figure out how to force-reinstall PS 5.1 but I don't find a way.
There's an official download page for WMF 5.1 but all options seem for older Windows (7, 8.1, Server etc).
If you know a way let me know :)

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
What if you run cmd.exe, and then powershell.exe from inside that? That at least might give you an error message, instead of a flicker and close.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
  • Operating System
    Linux Mint 21.2 (Cinnamon)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC8i5BEH
    CPU
    Intel Core i5-8259U CPU @ 2.30GHz
    Memory
    32 GB
    Graphics card(s)
    Iris Plus 655
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
What if you run cmd.exe, and then powershell.exe from inside that? That at least might give you an error message, instead of a flicker and close.
Can you give me instructions how to do it?
And, would that serve just as a test or what purpose would it have? I mean, would fix PS 5.1 32 bit so that I can run this utility finally?
 

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
Run the 32-bit version of cmd ("C:\Windows\SysWOW64\cmd.exe"), then type powershell.exe. It should automatically try to run the 32-bit version of powershell.exe, and we might get an error message to help diagnose the issue, since you seem averse to DISM/SFC.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
  • Operating System
    Linux Mint 21.2 (Cinnamon)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC8i5BEH
    CPU
    Intel Core i5-8259U CPU @ 2.30GHz
    Memory
    32 GB
    Graphics card(s)
    Iris Plus 655
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
Run the 32-bit version of cmd ("C:\Windows\SysWOW64\cmd.exe"), then type powershell.exe. It should automatically try to run the 32-bit version of powershell.exe, and we might get an error message to help diagnose the issue, since you seem averse to DISM/SFC.

'powershell.exe' is not recognized as an internal or external command,
operable program or batch file.

Btw I've tried with the 64bit CMD and it has the same result.

I am not averse to neither DISM nor SFC in the slightest.
I used SFC, no errors found. No errors found with chkdsk /x /b /f either, btw.
I would not mind using DISM if it's a command that won't forcibly undo all the changes I've made to the system (like the preinstalled apps I removed, or some features I disabled).
 

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
'powershell.exe' is not recognized as an internal or external command,
operable program or batch file.

Btw I've tried with the 64bit CMD and it has the same result.

I am not averse to neither DISM nor SFC in the slightest.
I used SFC, no errors found. No errors found with chkdsk /x /b /f either, btw.
I would not mind using DISM if it's a command that won't forcibly undo all the changes I've made to the system (like the preinstalled apps I removed, or some features I disabled).
Try running the explicit path. That is, copy and paste this (at the CMD prompt):

%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

You may also try:

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe

or:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

From a 32 bit CMD prompt, those last two commands should get redirected to the 32 bit version (which is in the, unfortunately named, SYSWOW64 folder). If the only problem is that the PowerShell folder is missing from the search path, these commands should work. However, I also expect them to fail on your machine because WinSetView explicitly runs PowerShell.exe from it's normal location. It does not depend on the search path.

Edit: Have you already checked to see if C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe even exists on your machine?
 
Last edited:

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
Try running the explicit path. That is, copy and paste this (at the CMD prompt):

all three codes (plus also C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe) give back:
Reading the value of registry key SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\PowerShellVersion causes the following Win32 error:
The system cannot find the file specified.

Running the same codes in the 64bit CMD gives the same result for the 32bit powershell, while it seems to succeed for the 64bit one:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! Migrating from Windows PowerShell 5.1 to PowerShell 7 - PowerShell
 

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
can try installing WMF 5.1 and see if its updates to powershell will fix your 5.1 installation files
Well, like I said somewhere, that download page doesn't offer a version for Windows 11.
It only offers:
Win7AndW2K8R2-KB3191566-x64.zip
Win8.1-KB3191564-x86.msu
Win7-KB3191566-x86.zip
W2K12-KB3191565-x64.msu
Win8.1AndW2K12R2-KB3191564-x64.msu



Btw @LesFerch I feel like I'm hijacking your thread with an issue which does prevent me from using your tool but it's not directly related to your tool.
If you want me to open a separate thread let me know.
 

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
Btw @LesFerch I feel like I'm hijacking your thread with an issue which does prevent me from using your tool but it's not directly related to your tool.
If you want me to open a separate thread let me know.
Yes, I think it would be good if we can have a mod move messages starting at #72 to a new thread. Maybe a title of "PowerShell issue prevents running WinSetView"? I'll ping @Brink and @z3r010
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
Yes, I think it would be good if we can have a mod move messages starting at #72 to a new thread. Maybe a title of "PowerShell issue prevents running WinSetView"? I'll ping @Brink and @z3r010

Done. :alien:
 

My Computers

System One System Two

  • OS
    Windows 11 Pro for Workstations
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom self build
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING (11GB GDDR5X)
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G75 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3 wall mounted
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gbps Download and 35 Mbps Upload
    Browser
    Google Chrome
    Antivirus
    Microsoft Defender and Malwarebytes Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    CyberPower CP1500PFCLCD
    Galaxy S23 Plus phone
  • Operating System
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Surface Laptop 7 Copilot+ PC
    CPU
    Snapdragon X Elite (12 core) 3.42 GHz
    Memory
    16 GB LPDDR5x-7467 MHz
    Monitor(s) Displays
    15" HDR
    Screen Resolution
    2496 x 1664
    Hard Drives
    1 TB SSD
    Internet Speed
    Wi-Fi 7 and Bluetooth 5.4
    Browser
    Chrome and Edge
    Antivirus
    Windows Defender
Ok, good that I asked.

So, @LesFerch , while I solve whatever tf issue is preventing my windows powershell 32 bit from starting:
What can I do to have WinSetView.ps1 run with Windows powershell 64 bit or with powershell core?
I tried editing it in notepad and replacing powershell.exe with pwsh.exe in the line:
Start-Process -WindowStyle Hidden -FilePath "PowerShell.exe" -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command $Cmd" -Verb RunAs 2>$Null
 

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
Ok, good that I asked.

So, @LesFerch , while I solve whatever tf issue is preventing my windows powershell 32 bit from starting:
What can I do to have WinSetView.ps1 run with Windows powershell 64 bit or with powershell core?
I tried editing it in notepad and replacing powershell.exe with pwsh.exe in the line:
Start-Process -WindowStyle Hidden -FilePath "PowerShell.exe" -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command $Cmd" -Verb RunAs 2>$Null
That line is for the processing of the few settings that require UAC. It won't change how the script itself is launched.

What you can do for now is manually run the script. Since you already have your preferences saved, you can run a command like the following from any prompt, such as the Run box:

powershell "C:\Tools\WinSetView\WinSetView.ps1" "C:\Tools\WinSetView\AppData\Win10.ini"
or
pwsh "C:\Tools\WinSetView\WinSetView.ps1" "C:\Tools\WinSetView\AppData\Win10.ini"

Obviously, replace the paths in those examples to the correct paths for your computer.
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer

Latest Support Threads

Back
Top Bottom