Comparing PowerShell to Linux User Manipulation
-
So @scottalanmiller , I had to make some serious edits here on your guide due to your extreme bias against Windows / PowerShell. Hopefully you fix them in the OP:
List Local Users
Get-LocalUser #PowerShell - simple. Cat /etc/passwd | grep "/bin/bash" #BASH - good luck!
Get Details of Specific Local User
Get-LocalUser salty #PowerShell - Simple, pretty output you can do something with id sally #BASH - simple command, nasty output!
Create a New Local User
New-LocalUser salty #PowerShell - super simple, automatically prompts for password useradd sally #BASH - simple passwd p@ssw0rd #BASH - simple, insecure
Delete a Local User
Remove-LocalUser salty #PowerShell - simple enough to guess deluser sally #BASH - simple enough to guess
With Tab Completion in PowerShell, these commands are a breeze.
But if that's still too much to handle...With many common commands, there are well-known aliases:
Remove-LocalUser salty
rlu salty
New-LocalUser salty
nlu salty
Get-LocalUser salty
glu salty
Super simple, nice and easy to handle output. Handles passwords in a single command
nlu salty
@WrCombs .Not sure what you tried @scottalanmiller ...
-
@Obsolesce you don't really think that that stuff makes it simple, do you?
-
@Obsolesce said in Managing Windows Local Users with PowerShell:
Get-LocalUser #PowerShell - simple.
Cat /etc/passwd | grep "/bin/bash" #BASH - good luck!This isn't how it works. All users are listed in /etc/passwd. Grepping for BASH does nothing useful, and would be very misleading. If you want a list of all users, it's just "cat /etc/passwd". That simple.
-
@scottalanmiller said in Managing Windows Local Users with PowerShell:
@Obsolesce said in Managing Windows Local Users with PowerShell:
Get-LocalUser #PowerShell - simple.
Cat /etc/passwd | grep "/bin/bash" #BASH - good luck!This isn't how it works. All users are listed in /etc/passwd. Grepping for BASH does nothing useful, and would be very misleading. If you want a list of all users, it's just "cat /etc/passwd". That simple.
Yeah but who wants to look at a list of like 50 system users before finding what they are really after. And the output is ugly AF tbh.
-
@scottalanmiller said in Managing Windows Local Users with PowerShell:
That simple.
Not as simple as, simply
glu
. -
@Obsolesce said in Managing Windows Local Users with PowerShell:
Get-LocalUser salty #PowerShell - Simple, pretty output you can do something with
id sally #BASH - simple command, nasty output!You are mentioning BASH, but using "id". You are mixing what is the shell and what is a tool, this is what we were talking about in the other thread. You have to really understand when you are using a shell and when you are not to make useful comparisons.
But the info here isn't uniform. In one case you use /etc/passwd and in another you are looking for a tool. Why switch?
If you want basic info, just grep username /etc/passwd. Super simple (and standard... this is the biggest thing in Linux, same format over and over, not a unique tool for every task like PowerShell.)
If you want more info, yes use the insanely simple and easy to read id command. Which you say has "nasty output", but compare to PowerShell. Short, simpler, and couldn't be easier to read. The PowerShell is fine, but way more verbose.
Your bias is showing, there was no reason to post a comparison here, this is a thread about Windows Systems Management. But it does show just how extremely ridiculous PowerShell is, and the lengths that are necessary to make it seem reasonable.
Memorizing several different commands are another set of "well known" crazy little abbreviations that are dangerous if you can't memorize millions of them.
And you conveniently left out that almost no Windows has this PowerShell stuff, it's non-standard! Only extremely current versions have this without having to go through hoops to install it extra. This isn't universally workable for PowerShell.
-
@Obsolesce said in Managing Windows Local Users with PowerShell:
@scottalanmiller said in Managing Windows Local Users with PowerShell:
That simple.
Not as simple as, simply
glu
.Actually, it's way simpler than memorizing obtuse, non-obvious abbreviations which you need a different one for every form, of every task.
-
@scottalanmiller said in Managing Windows Local Users with PowerShell:
@Obsolesce said in Managing Windows Local Users with PowerShell:
Get-LocalUser salty #PowerShell - Simple, pretty output you can do something with
id sally #BASH - simple command, nasty output!You are mentioning BASH, but using "id". You are mixing what is the shell and what is a tool, this is what we were talking about in the other thread. You have to really understand when you are using a shell and when you are not to make useful comparisons.
But the info here isn't uniform. In one case you use /etc/passwd and in another you are looking for a tool. Why switch?
If you want basic info, just grep username /etc/passwd. Super simple (and standard... this is the biggest thing in Linux, same format over and over, not a unique tool for every task like PowerShell.)
If you want more info, yes use the insanely simple and easy to read id command. Which you say has "nasty output", but compare to PowerShell. Short, simpler, and couldn't be easier to read. The PowerShell is fine, but way more verbose.
Your bias is showing, there was no reason to post a comparison here, this is a thread about Windows Systems Management. But it does show just how extremely ridiculous PowerShell is, and the lengths that are necessary to make it seem reasonable.
Memorizing several different commands are another set of "well known" crazy little abbreviations that are dangerous if you can't memorize millions of them.
And you conveniently left out that almost no Windows has this PowerShell stuff, it's non-standard! Only extremely current versions have this without having to go through hoops to install it extra. This isn't universally workable for PowerShell.
Way to strawman there...
-
@Obsolesce said in Managing Windows Local Users with PowerShell:
Yeah but who wants to look at a list of like 50 system users before finding what they are really after. And the output is ugly AF tbh.
You are struggling hard to make something really easy seem hard. Yes, it lists all of the users, not just some. Would you really want a list of only some users? Which ones?
-
@Obsolesce said in Managing Windows Local Users with PowerShell:
@scottalanmiller said in Managing Windows Local Users with PowerShell:
@Obsolesce said in Managing Windows Local Users with PowerShell:
Get-LocalUser salty #PowerShell - Simple, pretty output you can do something with
id sally #BASH - simple command, nasty output!You are mentioning BASH, but using "id". You are mixing what is the shell and what is a tool, this is what we were talking about in the other thread. You have to really understand when you are using a shell and when you are not to make useful comparisons.
But the info here isn't uniform. In one case you use /etc/passwd and in another you are looking for a tool. Why switch?
If you want basic info, just grep username /etc/passwd. Super simple (and standard... this is the biggest thing in Linux, same format over and over, not a unique tool for every task like PowerShell.)
If you want more info, yes use the insanely simple and easy to read id command. Which you say has "nasty output", but compare to PowerShell. Short, simpler, and couldn't be easier to read. The PowerShell is fine, but way more verbose.
Your bias is showing, there was no reason to post a comparison here, this is a thread about Windows Systems Management. But it does show just how extremely ridiculous PowerShell is, and the lengths that are necessary to make it seem reasonable.
Memorizing several different commands are another set of "well known" crazy little abbreviations that are dangerous if you can't memorize millions of them.
And you conveniently left out that almost no Windows has this PowerShell stuff, it's non-standard! Only extremely current versions have this without having to go through hoops to install it extra. This isn't universally workable for PowerShell.
Way to strawman there...
My point was... you are coming up with hard ways to do things, when easy ones exist. And your examples show a way harder process in PowerShell.
-
In both PowerShell and BASH/useradd you can do a user creation in a single line. It's not pretty and uses a single procedure in both. I don't know the PS version, but this is the BASH version. PS is very similar, though, just different strong commands.
useradd -p $(echo mysecret | openssl passwd -1 -stdin) sally
-
Hey sorry to interrupt.
Why was I tagged in this?
just curious / -
@WrCombs said in Comparing PowerShell to Linux User Manipulation:
Hey sorry to interrupt.
Why was I tagged in this?
just curious /Because he branched off of a question you had initially asked about "how would this look in Linux". But went way off on a tangent, so it was forked.
-
@WrCombs said in Comparing PowerShell to Linux User Manipulation:
Hey sorry to interrupt.
Why was I tagged in this?
just curious /If you look at the bottom of the OP, he tagged you to show you that the New-LocalUser command will prompt for an interactive password after you run it if you don't do anything else, but that was in my original post already, so not sure why it was mentioned.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
@WrCombs said in Comparing PowerShell to Linux User Manipulation:
Hey sorry to interrupt.
Why was I tagged in this?
just curious /Because he branched off of a question you had initially asked about "how would this look in Linux". But went way off on a tangent, so it was forked.
Ah, Thanks.
Yeah i was just curious how the two syntaxs were different Because @StuartJordan (i think )
said "using Bash" instead of Using Linux CLI to do the same thing as powershell looked better. I remember now . -
@WrCombs said in Comparing PowerShell to Linux User Manipulation:
Yeah i was just curious how the two syntaxs were different Because @StuartJordan (i think )
said "using Bash" instead of Using Linux CLI to do the same thing as powershell looked better. I remember now .It's a little confusing, which Ob alluded to but didn't point out too much and is a valid point that he should have made, is that on the Linux side some of what we are using is Bash, and some of what we are using is user management commands.
This is definitely part of the downside to the Linux approach is that sometimes you have a tool, and sometimes you are manipulating a text file. Both are easy, but they are very different. Of course, technically that is optional, it wasn't that long ago that we didn't use the tools and we just edited the text files. It's not hard, but it is unnecessarily hard and would look pretty foolish today if it was the only approach.
But some tasks don't quite have an alternative, because the text file is so easy. Like Ob's example of "getting all users". You just read the whole table and there it is. But this creates a "half the stuff one way, half the stuff another way" problem which, while each task is easy, isn't consistent. PowerShell makes it all consistent, but all more complicated.
In PS, everything is a unified commandlet, and nothing is "interact with the OS directly." In Linux, there are tools for some tasks, and others you just work with the OS' files. It would be nice to see Linux bridge that gap with a unified management toolset at some point.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
@Obsolesce said in Managing Windows Local Users with PowerShell:
@scottalanmiller said in Managing Windows Local Users with PowerShell:
That simple.
Not as simple as, simply
glu
.Actually, it's way simpler than memorizing obtuse, non-obvious abbreviations which you need a different one for every form, of every task.
I personally never use aliases, even though I memorize most of the common ones because they are usually the first letters of each word. I mentioned that for the silly people who are counting command characters. Who gives a shit between the difference of typing
New-LocalUser
vsadduser + passwd
. It's simple enough, and if you are typing those a lot, it's about time you make yourself useful and learn to script and automate.... or change how you manage local users, for example. -
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
and if you are typing those a lot, it's about time you make yourself useful and learn to script and automate
That's easy to say, but there are tons and tons of people out there who use these all day, every day, but cannot automate because they aren't in a uniform environment. Remember the biggest Windows admin group is MSPs, not "single customer environments" and quite an astounding volume of Windows management by industry percentage is done through tools that require environmental-less remote command execution, use CMD not PS (at least by default), and cannot have newer PS versions, and cannot have an automation toolset of any significance.
I'm sure that there are automation ideas out there even for MSPs. But when you manage thousands of totally disconnected Windows desktops, what is there to automate? Having fast, simple tools that are universally available is about the best that you can do.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
and if you are typing those a lot, it's about time you make yourself useful and learn to script and automate
That's easy to say, but there are tons and tons of people out there who use these all day, every day, but cannot automate because they aren't in a uniform environment. Remember the biggest Windows admin group is MSPs, not "single customer environments" and quite an astounding volume of Windows management by industry percentage is done through tools that require environmental-less remote command execution, use CMD not PS (at least by default), and cannot have newer PS versions, and cannot have an automation toolset of any significance.
I'm sure that there are automation ideas out there even for MSPs. But when you manage thousands of totally disconnected Windows desktops, what is there to automate? Having fast, simple tools that are universally available is about the best that you can do.
If they are mostly all managing local users, no usable PowerShell, no automation, etc, then why are they using Windows in the first place?
-
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
If they are mostly all managing local users, no usable PowerShell, no automation, etc, then why are they using Windows in the first place?
None of those are reasons why people choose Windows. People choose Windows primarily because of app compatibility or familiarity with the GUI environment for end users. If IT alone chose an OS for their own purposes, Windows would never be considered at all, it just doesn't make sense in that way (nor does choosing something in that way.) In fact, MS automation has always been a weak point, so if anything, lacking an ability or need for automation would make the argument for choosing Windows stronger, not weaker.
But you are also defining PowerShell as "usable" based on extremely new versions. Maybe this is true, but keep in mind that your argument basically is that PowerShell has been a failure for a decade.