I am trying to use runas
in a PowerShell function to serve as a poor man's sudo
, but runas
doesn't seem to actually give me admin access. For example, I get an access denied when running:
runas /user:admin "cmd /K mkdir C:\Windows\System32\mydirectory"
Also, if I open vim and try to write a file to System32, it gives me an error when I save:
runas /user:admin "C:\Program Files (x86)\Vim\vim74\gvim.exe C:\Windows\System32\mynewtextfile.txt"
I don't think it's a credentials issue, because I can do non-admin tasks like write files to the desktop, and my password seem to work ok. I checked in the "Computer Management" tool in the Administrative Tools, and "admin" is in the "Administrators" group. What am I missing? I am on Windows 7 Pro.