On my Windows 7 Desktop, I have script.ps1, which needs admin privileges (it starts a service). I want to click on this script and run it with admin privileges.
What's the easiest way to accomplish this?
|
On my Windows 7 Desktop, I have script.ps1, which needs admin privileges (it starts a service). I want to click on this script and run it with admin privileges. What's the easiest way to accomplish this?
| |||
feedback
|
|
Here is one way of doing it, with the help of an additional icon on your desktop. I guess you could move the script someone else if you wanted to only have a single icon on your desktop.
You can now run the script elevated by simple double-clicking the new shortcut on your desktop. | |||
|
feedback
|
|
Since it's sitting onto your desktop, I'd say the most effortless way to get this done is dragging it onto the elevation gadget. Otherwise you could make a separate script using the Or, you could apply | ||||
|
feedback
|
|
if you are in the same powershell you could do this:
| |||
|
feedback
|
|
You can run PowerShell scripts in Windows 7 using powershell_ise. Step by step instruction can be found here. | ||||
|
feedback
|