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).
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.
-
@JaredBusch said in Comparing PowerShell to Linux User Manipulation:
@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.
[jbusch@lt-jared ~]$ grep jbusch /etc/passwd jbusch:x:1103:1103:Jared Busch:/home/jbusch:/bin/bash [jbusch@lt-jared ~]$
That's listing a single user, the context was listing all local users.
-
@JaredBusch said in Comparing PowerShell to Linux User Manipulation:
@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 p@ssw0rd #BASH - simple, insecureWTF? 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.
Shit yeah I did know that.
Still, it's two commands, versus one with PowerShell, unless you write a long one-liner in BASH.
-
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
@JaredBusch said in Comparing PowerShell to Linux User Manipulation:
@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 p@ssw0rd #BASH - simple, insecureWTF? 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.
Shit yeah I did know that.
Still, it's two commands, versus one with PowerShell, unless you write a long one-liner in BASH.
Yes, still two commands. Although the PS one is interactive. Which still sucks, too. In this case, PS is slightly better, I feel, but net user beats either.
-
-
-
Understood, Windows is basically crazy complex and non-standard even within itself and needs special tooling to get to where Linux is out of the box The simple answer is, the best tooling in the world will never fix the underlying complexities baked into the Windows product line and PowerShell is an attempt to make the best of a less than ideal situation. Whereas on Linux the approach has been to take a standard approach whenever possible allowing generic tools to be elegant and effective.
-
Objects certainly have advantages, but text has some whopping advantages, too. Like "what you see is real" rather than "what you see is a representation." It's amazing how much power not abstracting the basic configuration away from the admin provides. Yes, it can make getting specific output parsed a little harder in some cases, but means that the data provided is always parsable. Windows relies on special tools for every task, and if those tools aren't made or have issues, tough. With text interfaces, those problems don't really exist.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
Understood, Windows is basically crazy complex and non-standard even within itself and needs special tooling to get to where Linux is out of the box The simple answer is, the best tooling in the world will never fix the underlying complexities baked into the Windows product line and PowerShell is an attempt to make the best of a less than ideal situation. Whereas on Linux the approach has been to take a standard approach whenever possible allowing generic tools to be elegant and effective.
Exactly.
-
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
Understood, Windows is basically crazy complex and non-standard even within itself and needs special tooling to get to where Linux is out of the box The simple answer is, the best tooling in the world will never fix the underlying complexities baked into the Windows product line and PowerShell is an attempt to make the best of a less than ideal situation. Whereas on Linux the approach has been to take a standard approach whenever possible allowing generic tools to be elegant and effective.
Exactly.
This is why comparing PowerShell to CMD is kind of useful, but comparing to BASH is much lessso. When people look at them, then tend to use PowerShell for Windows tasks and BASH for non-Windows tasks. Which makes sense for usage, but no one is actually comparing PS and BASH, they are comparing Windows and Linux tasks.
PS on Linux works the same as on Windows, but isn't very efficient. It can do essentially anything BASH can do, but is generally slower and more difficult. But on Windows, BASH does haven't the interfaces that PS has, so what it does it does really well, but what it doesn't do is pretty big.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
This is why comparing PowerShell to CMD is kind of useful, but comparing to BASH is much lessso.
This is why I said from the beginning it's not apples to apples between PoSh and Bash.
-
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
This is why I said from the beginning it's not apples to apples between PoSh and Bash.
It can be, though. Because there are times where the shells themselves are what we are comparing. And the discussion I had been having originally, was purely about the shells. Things like startup times and reaction times, for which PS is extremely slow compared to Bash. When you put them into an apples to apples mode, just using them to do things like a remote connection or to run a command, PS is extremely slow. When we are comparing their functionality, they are used for generally very different things. But there are absolutely, like what we were initially discussing, when they are identical and the underlying performance differences are very visible.
-
As far as I know, robocopy is still the best file copying/syncing utility included in Windows, and you have to parse the output to get any anything useful back to work with in Powershell.
^ another example of Windows administration mismatch
-
@flaxking said in Comparing PowerShell to Linux User Manipulation:
As far as I know, robocopy is still the best file copying/syncing utility included in Windows, and you have to parse the output to get any anything useful back to work with in Powershell.
^ another example of Windows administration mismatch
Interesting, so it outputs in text, not objects? Robocopy is definitely the best, never realized that PS didn't fully integrate.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
@flaxking said in Comparing PowerShell to Linux User Manipulation:
As far as I know, robocopy is still the best file copying/syncing utility included in Windows, and you have to parse the output to get any anything useful back to work with in Powershell.
^ another example of Windows administration mismatch
Interesting, so it outputs in text, not objects? Robocopy is definitely the best, never realized that PS didn't fully integrate.
Robocopy isn't PowerShell or a PowerShell cmdlet, function, or module. AFAIK, that's where you get to work with objects.
However, you can really easily parse the output of Robocopy and turn it into a really nice and usable object
-
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
Robocopy isn't PowerShell or a PowerShell cmdlet, function, or module. AFAIK, that's where you get to work with objects.
But wasn't the point that PS was needed to do those things because that is how "Windows" works? If PS only does those things because that is how PS works, then PS is total garbage. It doesn't matter that it isn't part of PS, it's part of Windows, hence should follow the Windows rules.
-
And, likewise, if it is part of Windows, then it is PowerShell's job to interact with it effectively.
-
@scottalanmiller said in Comparing PowerShell to Linux User Manipulation:
@Obsolesce said in Comparing PowerShell to Linux User Manipulation:
Robocopy isn't PowerShell or a PowerShell cmdlet, function, or module. AFAIK, that's where you get to work with objects.
But wasn't the point that PS was needed to do those things because that is how "Windows" works? If PS only does those things because that is how PS works, then PS is total garbage. It doesn't matter that it isn't part of PS, it's part of Windows, hence should follow the Windows rules.
Maybe you didn't understand.
Robocopy isn't Windows.
Robocopy works great from PowerShell, but Robocopy itself is it's own separate tool in which all logging is text based. It's not at all the same as working with Windows API or an app like Excel...
-
PowerShell has its own way to work with files built in, even though Robocopy is easier to use.