This topic contains 5 replies, has 4 voices, and was last updated by
December 7, 2016 at 11:22 am #59611
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 ,
December 7, 2016 at 2:54 pm #59640ParticipantPoints: 18Rank: Member
I have not tested this myself, but have a look at the Re-launch Powershell Script Elevated Script Center script
December 7, 2016 at 3:12 pm #59656
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
December 7, 2016 at 2:58 pm #59647ParticipantPoints: 35Rank: Member
if you use Sapien Studio, when you build the program you can set it with an elevated manifest
December 7, 2016 at 3:30 pm #59659
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
December 7, 2016 at 4:43 pm #59668ParticipantPoints: 52Rank: Member
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.
The topic ‘Force Programe to run as Administrator’ is closed to new replies.