In the PowerShell script itself, check to see if it has an admin token. If it doesn't, then relaunch powershell.exe using Start-Process with -Verb RunAs so that it will have the admin token.
In other words, what is shown here: http://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator From: [email protected] [mailto:[email protected]] On Behalf Of James Rankin Sent: Wednesday, August 31, 2016 12:45 PM To: [email protected] Subject: [NTSysADM] More PowerShell help How can I get a PowerShell script to run with administrative privileges? I have a configuration script I want to run on my Windows 10 machines, obviously it is going to be run by an admin user, but I want to just double-click the script and it runs with admin privileges. At the minute I have to launch PowerShell as an admin and then run the script directly - what's the best way to be able to do this with a simple double-click action? Cheers, James Rankin EUC Solutions Architect | 07809 668579 | [email protected]<mailto:[email protected]> One Trinity Green, Eldon Street, South Shields, Tyne & Wear, NE33 1SA Tel: 0191 481 3446

