SomeTechGuy
New Member
- Messages
- 17
- Reaction score
- 2
My issue was that certain choco installs in my PowerShell script were halting due to it prompting for an action button (y/n) to continue. After reading many forms here and elsewhere, it is because the first run, runs as the system account which can affect some of the choco apps. I found a fix for this which is to run with admin rights (assuming your user account has local admin). To make this happen, review the following:
My Post-Setup:

I complete a move on the script as a verification it makes it on the image as part of my testing.
After Logon Actual command: Powershell -Command "Start-Process PowerShell -Args '-ExecutionPolicy Bypass -File C:\UpdatePC.ps1' -Verb RunAs"
PowerShell -NoProfile -ExecutionPolicy Bypass - Runs from the system Account after the very first sign in.
Start-Process PowerShell.exe - This now runs everything from the user account
Note: -Verb RunAs specifies that the new PowerShell process will be started in an Administrator window. Found this golden nugget straight from a Microsoft support page. Look at their Example 5: https://learn.microsoft.com/en-us/p....management/start-process?view=powershell-7.4
Example from a first run test:

This works for me and has been successfully tested. Happy scripting!
My Post-Setup:

I complete a move on the script as a verification it makes it on the image as part of my testing.
After Logon Actual command: Powershell -Command "Start-Process PowerShell -Args '-ExecutionPolicy Bypass -File C:\UpdatePC.ps1' -Verb RunAs"
PowerShell -NoProfile -ExecutionPolicy Bypass - Runs from the system Account after the very first sign in.
Start-Process PowerShell.exe - This now runs everything from the user account
Note: -Verb RunAs specifies that the new PowerShell process will be started in an Administrator window. Found this golden nugget straight from a Microsoft support page. Look at their Example 5: https://learn.microsoft.com/en-us/p....management/start-process?view=powershell-7.4
Example from a first run test:

This works for me and has been successfully tested. Happy scripting!
Attachments
Last edited: