Windows – How to run commands in PowerShell with Administrator permissions

administratorpowershellrunassudowindows 7

I would like to run commands in PowerShell with Administrator permissions? How can I do that?

I have tried to start PowerShell with the runas command, but PowerShell is closed immediately after I have typed a password.

I use Windows 7 and I am the only user on the computer.

Best Answer

Usually when I see powershell immediately close, its a problem with the Execution Policy. clicking the Orb, typing Powershell then Right Clicking the link, and "run as Administrator" and have it open that way?

You can then, to see whats going on, navigate to the folder where your script is, and do a ./NameofScript.ps1

Related Question