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 [email protected] #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 vs adduser + 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.



  • It interesting to think about, one complaint about Linux is that it has fragmented off into tons of different distributions, however it's has managed to keep a lot of the tools standardized across them all.



  • @flaxking said in Comparing PowerShell to Linux User Manipulation:

    It interesting to think about, one complaint about Linux is that it has fragmented off into tons of different distributions, however it's has managed to keep a lot of the tools standardized across them all.

    That's very true. It's even moreso than that. Many of those tools remains standard across not just operations systems, but OS familys, too. AIX, Solaris, BSD, Linux... all those families tend to share a lot of tooling.



  • @scottalanmiller said in Comparing PowerShell to Linux User Manipulation:

    @flaxking said in Comparing PowerShell to Linux User Manipulation:

    It interesting to think about, one complaint about Linux is that it has fragmented off into tons of different distributions, however it's has managed to keep a lot of the tools standardized across them all.

    That's very true. It's even moreso than that. Many of those tools remains standard across not just operations systems, but OS familys, too. AIX, Solaris, BSD, Linux... all those families tend to share a lot of tooling.

    It's because the tools aren't linux, it's GNU. Gnu is Not linUx.



  • @Pete-S said in Comparing PowerShell to Linux User Manipulation:

    It's because the tools aren't linux, it's GNU. Gnu is Not linUx.

    Not GNU. The tools predate Gnu. Gnu remade many of them and they are often used across some of those groups, like Linux and BSD, but rarely in others like AIX.

    It's more of just standards.



  • @scottalanmiller said in Comparing PowerShell to Linux User Manipulation:

    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.

    WTF? What version of Windows are you claiming here? Because PowerShell has been install by default since Windows 7 (PowerShell version 2.0).



  • @Obsolesce said in Comparing PowerShell to Linux User Manipulation:

    Create a New Local User
    New-LocalUser salty #PowerShell - super simple, automatically prompts for password
    useradd sally #BASH - simple
    passwd [email protected] #BASH - simple, insecure

    WTF? Insecure? Are you fucking stupid?

    Also the correct syntax is passwd salty and guess what, it prompts you to enter the password.

    How about that, it is not any different between the two systems.



  • @Obsolesce said in Comparing PowerShell to Linux User Manipulation:

    List Local Users
    Get-LocalUser #PowerShell - simple.
    Cat /etc/passwd | grep "/bin/bash" #BASH - good luck!

    As @scottalanmiller already stated, you don't even know what you are trying to compare here as you, again, used incorrect syntax.

    grep salty /etc/passwd

    Real life results from my laptop. Simple colon delimited output.

    [[email protected] ~]$ grep jbusch /etc/passwd
    jbusch:x:1103:1103:Jared Busch:/home/jbusch:/bin/bash
    [[email protected] ~]$ 
    


  • @JaredBusch said in Comparing PowerShell to Linux User Manipulation:

    @scottalanmiller said in Comparing PowerShell to Linux User Manipulation:

    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.

    WTF? What version of Windows are you claiming here? Because PowerShell has been install by default since Windows 7 (PowerShell version 2.0).

    And Powershell 2.0 is missing a lot of stuff that are taken for granted by Powershell users today. If WMF was made available through Windows updates, that would have made life easier.



  • @JaredBusch said in Comparing PowerShell to Linux User Manipulation:

    @scottalanmiller said in Comparing PowerShell to Linux User Manipulation:

    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.

    WTF? What version of Windows are you claiming here? Because PowerShell has been install by default since Windows 7 (PowerShell version 2.0).

    Who said PowerShell wasn't there? The mistake is thinking that PowerShell does any of the work, it doesn't. CmdLets do. And the CmdLets that do the work aren't part of the PowerShell packages on Windows 7. You can add them manually, just like you can add different versions of PowerShell. But the PS and PS ecosystem that are part of Windows 7 lack the functionality being discussed, like user and group management. You can write really obtuse, lengthy code to do it, but it is absurd and totally impractical.



  • @flaxking said in Comparing PowerShell to Linux User Manipulation:

    @JaredBusch said in Comparing PowerShell to Linux User Manipulation:

    @scottalanmiller said in Comparing PowerShell to Linux User Manipulation:

    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.

    WTF? What version of Windows are you claiming here? Because PowerShell has been install by default since Windows 7 (PowerShell version 2.0).

    And Powershell 2.0 is missing a lot of stuff that are taken for granted by Powershell users today. If WMF was made available through Windows updates, that would have made life easier.

    Exactly. PS on Windows 7 basically requires that you either: add in lots of extra stuff that isn't native, use PS in a totally useless way just to prove a point, or fall back to traditional tools called through PS like the net commands. PS was functional in Windows 7 the same way that CMD was functional there... which is to say moderately, but not fully.


Log in to reply