I am Creating a GUI Application in PowerShell
But i am Dealing with Group Policy so All Hives in HKLM Needs Admin Privillige
i wrote a code that error is shown when the App is not running as Admin
But i want it when a user double click it even he didn’t click on " Run As Admin " That UAC Appears and Ask him to
run it as Admin , so i don’t bother Users with Error Appears asking him to run as Admin
so what should i do ?
Thanks in Advance ,
I have not tested this myself, but have a look at the Re-launch Powershell Script Elevated Script Center script
if you use Sapien Studio, when you build the program you can set it with an elevated manifest
i reed it but as i know it will run just if the User Run Ps1 Script Because it depending on "$MyInvocation.ScriptName "
i think it will not work if it converted to Exe But i will Try and i Hope It works
,
i wrote the above but before click submit i trtied to use the Script and it didn’t work even with Ps1
Thank You Christian Sandfeld for your Answer
First Thank you Mark Prior for your Answer
But i am not Using Sapien yet , but i will as you recommanded in my other question
But if it is no a GUI Script what should i do , I Know i can Take The Code From Sapien but i don’t have it right now
So Can you Tell Me How To do that
By The Way i am going to Convert Ps1 into Exe to Be Easy for The USer
My approach to something similar is to create a shortcut to launch the script/application. Then in the shortcut properties you can set it to always launch elevated.