I only have one account on my Windows Vista machine, and that user has administrative privileges. However, when I try to execute a command within PowerShell to kill a certain process, I'm greeted with an "Access is denied" message. How do I become the administrator?
|
feedback
|
|
The easiest way to do this is to launch Powershell with administration tokens. To do this, you right click on Powershell (or a shortcut to it) and click on "run as administrator". Alternatively you can use elevate.cmd. | |||
|
feedback
|
|
If you want to always run PowerShell with admin priveleges, you can right-click the PowerShell shortcut, then click the "Advanced..." button on the "Shortcut" tab, then select "Run as Administrator". | |||
|
feedback
|
|
This opens a new powershell instance:
I expect that there are issues with this - in particular, you won't get the output of your scriptblock back in the calling script. On the other hand, it will be there in the new PS instance so you can hack with it there. | |||
|
feedback
|
|
The Powershell v2 way, according to Microsoft, is to right click on the shortcut and choose Run as Administrator. And to elevate within a Powershell window:
Which from a cmd.exe batch file, shortcut or Run line would look something (repetitively) like this:
| ||||
|
feedback
|