Windows 11 Group Policy/Reg/Something Deployable RUN/EXECUTE .ps1 files by default


I will try that. What I've tried so far doesn't work because of the multiline
@'
PASSWORDVARIABLE
'@
Here string where the password gets inserted during generation of the script by the software. Nothing I've tried actually allows the here string to work. Putting it in one line results in multiple characters breaking the herestring too.
 

My Computer My Computer

At a glance

Windows 11 Insider Developer Preview7950x3D64GB G.skill 6000Mhz CL32 @ 6400Mhz CL30Nvidia Founders Edition RTX 4090
OS
Windows 11 Insider Developer Preview
Computer type
PC/Desktop
Manufacturer/Model
Custom
CPU
7950x3D
Motherboard
ASRock x670e Taichi
Memory
64GB G.skill 6000Mhz CL32 @ 6400Mhz CL30
Graphics Card(s)
Nvidia Founders Edition RTX 4090
Sound Card
Scarlett Solo 3rd Gen
Screen Resolution
1x4k@160hz and 2x1440p@165Hz
Hard Drives
8xDell SAS 800GB SSD, 1x4TB Samsung 990 Pro, 1x2TB Samsung 980 Pro, 2x2TB Samsung 980 Pro, 4x980GB Sandisk SATA SSD
PSU
Seasonic Prime Platinum 1200W
Case
Thermaltake Tower 900 White
Cooling
2x480 and 1x560 Rad custom loop
Keyboard
Glorius GMMK Pro
Mouse
Razer Naga Pro V2
Internet Speed
Symmetrical 1Gbps Fiber Optic on Palo Alto PA440
Browser
Microsoft Edge Developer Preview
I will try that. What I've tried so far doesn't work because of the multiline

Something like this should work. Save it as whatever.cmd or whatever.bat.
Code:
<# : PS1 via Cmd
@echo off
cd %~dp0
powershell -executionpolicy remotesigned -Command "Invoke-Expression $([System.IO.File]::ReadAllText('%~f0'))"
goto:eof
#>

@'
PASSWORDVARIABLE
'@

Write-Host 'Hi'
Read-Host
 

My Computer My Computer

At a glance

Windows 10/11
OS
Windows 10/11
Computer type
Laptop
Manufacturer/Model
Acer
How you looked into just updating the FTA's thru the GPO, instead of a local override?
Yes, nothing we tried worked to set PowerShell. I don't know if you've tried it but in our experience, if you set it and export it, it's blank, if you manually create the line in the XML it does nothing. Edit: for clarity sake, I should probably add, we are not trying to set PowerShell v7 or anything, just the builtin powershell in System32\WindowsPowerShell

I am going to mess with the code linked above a bit more tomorrow. I am also investigating creating a C# form from Powershell, then using the password manager that's trainable in the application to train it to fill out the form so that the password doesn't have to be embedded into the script. Running a batch to run the form in Powershell works without issue.
 

My Computer My Computer

At a glance

Windows 11 Insider Developer Preview7950x3D64GB G.skill 6000Mhz CL32 @ 6400Mhz CL30Nvidia Founders Edition RTX 4090
OS
Windows 11 Insider Developer Preview
Computer type
PC/Desktop
Manufacturer/Model
Custom
CPU
7950x3D
Motherboard
ASRock x670e Taichi
Memory
64GB G.skill 6000Mhz CL32 @ 6400Mhz CL30
Graphics Card(s)
Nvidia Founders Edition RTX 4090
Sound Card
Scarlett Solo 3rd Gen
Screen Resolution
1x4k@160hz and 2x1440p@165Hz
Hard Drives
8xDell SAS 800GB SSD, 1x4TB Samsung 990 Pro, 1x2TB Samsung 980 Pro, 2x2TB Samsung 980 Pro, 4x980GB Sandisk SATA SSD
PSU
Seasonic Prime Platinum 1200W
Case
Thermaltake Tower 900 White
Cooling
2x480 and 1x560 Rad custom loop
Keyboard
Glorius GMMK Pro
Mouse
Razer Naga Pro V2
Internet Speed
Symmetrical 1Gbps Fiber Optic on Palo Alto PA440
Browser
Microsoft Edge Developer Preview

Latest Support Threads

Back
Top Bottom