PS1 script doesn't work on Windows 11 22H2


jinkazama

Active member
Local time
11:07 PM
Posts
14
OS
Windows 11
I have a working ps1 script to install windows app (i use it on windows 10) but if i use it on Windows 11 22H2 it opens and close after 1 second.
I've enabled Developer mode but it doesn't work, someone can help me to use it?
I think it's Powershell Execution Policy issue.
Thank you
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
I have a working ps1 script to install windows app (i use it on windows 10) but if i use it on Windows 11 22H2 it opens and close after 1 second.
I've enabled Developer mode but it doesn't work, someone can help me to use it? Thank you
Do you run it as admin?
 

My Computers My Computers

  • At a glance

    All Branches but ReleaseAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Release
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
Do you run it as admin?
In contextual menu there is only "run with powershell" but it works on windows 10
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
Open the PowerShell and execute the .ps1 script from PowerShell to see error message.
 

My Computer My Computer

At a glance

Windows 11AMD Ryzen 7 5700GMicron Technology DDR4-3200 16GBNVIDIA GeForce RTX 3060
OS
Windows 11
Computer type
PC/Desktop
Manufacturer/Model
HP Pavilion
CPU
AMD Ryzen 7 5700G
Motherboard
Erica6
Memory
Micron Technology DDR4-3200 16GB
Graphics Card(s)
NVIDIA GeForce RTX 3060
Sound Card
Realtek ALC671
Monitor(s) Displays
Samsung SyncMaster U28E590
Screen Resolution
3840 x 2160
Hard Drives
SAMSUNG MZVLQ1T0HALB-000H1
First, open Powershell (not the script)... navigate to the directory that has the script and run it manually from there, that way the window wont just flash and go away, you may find an error message that explains what's going on... If that doesn't work, I have a few ideas, but if you don't mind, could you post the contents of the file so we can test it on our systems? (Obviously remove any personal info, keys, etc.)
 

My Computers My Computers

  • At a glance

    Windows 11 Pro βIntel® Core™ i7-1165G732 GB DDR4-3200 SDRAMIntel® Iris® Xᵉ Graphics
    OS
    Windows 11 Pro β
    Computer type
    Laptop
    Manufacturer/Model
    HP Pavilion Laptop 15-eg0070wm
    CPU
    Intel® Core™ i7-1165G7
    Memory
    32 GB DDR4-3200 SDRAM
    Graphics Card(s)
    Intel® Iris® Xᵉ Graphics
    Screen Resolution
    1920x1080
    Hard Drives
    2TB PCIe® NVMe™ M.2 SSD
  • At a glance

    macOS Ventura3.4 GHz Quad-Core Intel Core i540 GB 2400 MHz DDR4Radeon Pro 570 4 GB
    Operating System
    macOS Ventura
    Computer type
    PC/Desktop
    Manufacturer/Model
    Apple iMac 27" 5K (2017)
    CPU
    3.4 GHz Quad-Core Intel Core i5
    Memory
    40 GB 2400 MHz DDR4
    Graphics card(s)
    Radeon Pro 570 4 GB
    Monitor(s) Displays
    27" 5K, 34" UW
    Screen Resolution
    Mon 1: 5120 × 2880 Mon 2: 2560 x 1080
    Hard Drives
    32GB NVME, 1TB SSD
I got this error:
Code:
SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
Then i've googled and i've found this solution, in a administrator Powershell i run
Code:
Set-ExecutionPolicy RemoteSigned
and after this i can run ps1 directly from file.
Is there a way to apply this remotesigned command via script?
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
With that error, you have two choices... You can remove/alter the security feature that restricts the type of Powershell script you can run or the safer option which is to self-sign your script.

Just so you know, when you ran: Set-ExecutionPolicy RemoteSigned that 'sticks' so you don't need to run it again next time. It's a toggle, when you set the Policy to any of the options.

My suggestion would be to follow the instructions on this site (about Signing - PowerShell) to learn how to self-sign scripts that you have written. (Do NOT self-sign scripts you find online unless you understand what they are doing so you don't cause any problems.)
 

My Computers My Computers

  • At a glance

    Windows 11 Pro βIntel® Core™ i7-1165G732 GB DDR4-3200 SDRAMIntel® Iris® Xᵉ Graphics
    OS
    Windows 11 Pro β
    Computer type
    Laptop
    Manufacturer/Model
    HP Pavilion Laptop 15-eg0070wm
    CPU
    Intel® Core™ i7-1165G7
    Memory
    32 GB DDR4-3200 SDRAM
    Graphics Card(s)
    Intel® Iris® Xᵉ Graphics
    Screen Resolution
    1920x1080
    Hard Drives
    2TB PCIe® NVMe™ M.2 SSD
  • At a glance

    macOS Ventura3.4 GHz Quad-Core Intel Core i540 GB 2400 MHz DDR4Radeon Pro 570 4 GB
    Operating System
    macOS Ventura
    Computer type
    PC/Desktop
    Manufacturer/Model
    Apple iMac 27" 5K (2017)
    CPU
    3.4 GHz Quad-Core Intel Core i5
    Memory
    40 GB 2400 MHz DDR4
    Graphics card(s)
    Radeon Pro 570 4 GB
    Monitor(s) Displays
    27" 5K, 34" UW
    Screen Resolution
    Mon 1: 5120 × 2880 Mon 2: 2560 x 1080
    Hard Drives
    32GB NVME, 1TB SSD
Thank you for reply
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
I wanna share my experience, i've found a way to run single script without discalimers and prompt windows, just create a .bat file
Code:
powershell.exe -executionpolicy bypass -windowstyle hidden -noninteractive -nologo -file "scriptfilename.ps1"
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
Back
Top Bottom