Windows Sudo like command?

GT98

[H]ard|Gawd
Joined
Aug 29, 2001
Messages
1,267
I know about runas command, but is there a true sudo command in the windows command prompt that you can run that would give you temp admin rights (if you enter the admin password) if your logged into a standard windows account?
 
No there is not. Just they way the whole thing is setup.

Oh and stop using the cmd prompt and start using powershell. You will thank me in the log run.
 
No there is not. Just they way the whole thing is setup.

Oh and stop using the cmd prompt and start using powershell. You will thank me in the log run.

...

Yes, you can use Runas to launch cmd.exe with an account that has administrative rights.

Or you can Tweak UAC to prompt you for authentication when you are trying to do something that has administrative rights.


In regards to powershell vs the command shell... eh... powershell is an amazing tool, but it's not obsoleting the command prompt. Depending on what you're doing, cmd.exe might be quicker, as powershell often likes to take it's time opening. Regardless of the shell, the question is really still the same...
 
...

Yes, you can use Runas to launch cmd.exe with an account that has administrative rights.

Or you can Tweak UAC to prompt you for authentication when you are trying to do something that has administrative rights.


In regards to powershell vs the command shell... eh... powershell is an amazing tool, but it's not obsoleting the command prompt. Depending on what you're doing, cmd.exe might be quicker, as powershell often likes to take it's time opening. Regardless of the shell, the question is really still the same...

Trust me, MS is slowly killing the CMD. A lot of commands are being replaced by PS cmdlets, and some of them even warn you to not use them when you run them in PS or tell you they are going away. I guess you only see this from the server side if you work in it daily. Try running dcpromo in server 2012 for example. You only options for promotion are through the GUI or through a PS console now.
 
Code:
 runas /u:DOMAIN\user command

That's about as close as you can get.

It kinda sucks.

I have a friend that works for the powershell dev team and she says it is the most requested feature from IT people/Powerusers.
 
Code:
 runas /u:DOMAIN\user command

That's about as close as you can get.

It kinda sucks.

I have a friend that works for the powershell dev team and she says it is the most requested feature from IT people/Powerusers.

I don't really use PS or Windows, but isn't there a way to alias similar to your terminal's .rc / configuration file under Powershell?
 
Yes, you can create a cmdlet to do this with a single command and save it to a PS profile.

A true sudo/su would be better.
 
This is the one I use; basically just "sudo mycommand.exe" and you get a UAC prompt. I looked around at the relevant objects and methods a while back, I pretty sure you can make it so you just type a password within the console, if that's what you want instead. It also opens a new window, don't know if that can be remedied, never really thought about it before. Any way, if you use this, you would probably want to put it in your "c:\users\[username]\documents\windowspowershell\\Microsoft.PowerShell_profile.ps1" file that autoloads when you start powershell.


Code:
function sudo ([string]$file, [string]$arguments) {
$psi = new-object System.Diagnostics.ProcessStartInfo $file;
$psi.Arguments = $arguments;
$psi.Verb = "runas";
$psi.WorkingDirectory = get-location;
[System.Diagnostics.Process]::Start($psi);
}
 
Thanks guys, speaking of powershell...is there any good primers on it?

I cut my teeth with DOS 5.0 back in the day, so the old commands are ingrained...I've used powershell a little bit when I was admin on Office 365 at my last job.
 
Thanks guys, speaking of powershell...is there any good primers on it?

I cut my teeth with DOS 5.0 back in the day, so the old commands are ingrained...I.

LOL. How about someone who started with CPM 2.2? :)
 
Thanks guys, speaking of powershell...is there any good primers on it?

I cut my teeth with DOS 5.0 back in the day, so the old commands are ingrained...I've used powershell a little bit when I was admin on Office 365 at my last job.

Do you know C++, C# or VB, etc? It's pretty much like that, except you can type the statements into the command line, and it includes commands that are kinda command.exe like to make that kind of stuff easy. That said, my favorite book on powershell is "powershell in action". Free wise, there's this online book: http://blogs.technet.com/b/chitpro-...shell-course-book-available-for-download.aspx - and a few others too I think.
 
LOL. How about someone who started with CPM 2.2? :)

How about Basic on a C64 :)

My first true computer was a Commadore 128, running in C64 mode 95% of the time.

Got my first PC clone in 1990 or so
 
Do you know C++, C# or VB, etc? It's pretty much like that, except you can type the statements into the command line, and it includes commands that are kinda command.exe like to make that kind of stuff easy. QUOTE]


ugh I hate programming (outside of Cisco switches)....

thanks for the link though :)
 
Do you know C++, C# or VB, etc? It's pretty much like that, except you can type the statements into the command line, and it includes commands that are kinda command.exe like to make that kind of stuff easy. That said, my favorite book on powershell is "powershell in action". Free wise, there's this online book: http://blogs.technet.com/b/chitpro-...shell-course-book-available-for-download.aspx - and a few others too I think.

I just tried this link and i got a 404 on what I thought was the actual download page:
http://download.microsoft.com/download/4/7/1/47104ec6-410d-4492-890b-2a34900c9df2/Workshops-EN.zip

Anyone have a good link?
 
Back
Top