I use a .bat file to run a Powershell script. This worked in Windows 10, but in Windows 11 nothing happens.
@echo off
set INPUT=
set /P INPUT= Please enter Username: %=%
runas.exe /user:%USERDOMAIN%\%INPUT% "powershell.exe -WindowStyle hidden C:\Toolbox\Main.PS1"
set INPUT=
I have put in my credentials (it does ask for login and password). Normally it would run the power script with my uplift account and launch a box for me. Now it appears the script is not running at all.
How can I fix this?
you can use save the your file execution command in the .bat file (as shown below) with
-ExecutionPolicy Unrestricted
and if you click on .bat, it will call the PowerShell file and start to execute.