Limitations of Windows PowerShell vs. Linux SSH/bash

Limitations of Windows PowerShell vs. Linux SSH/bash

Summary: I've had the opportunity to work with PowerShell recently, on Windows 7. And I have to admit, I'm impressed with some things, but disappointed with others.

SHARE:
TOPICS: Open Source
26

I've had the opportunity to work with PowerShell recently, on Windows 7. And I have to admit, I'm impressed with some things, but disappointed with others. It's young as far as software is concerned, so that may be part of this. I've worked with the Bash shell on Linux for many years, and now that I had to use PowerShell I've seen some limitations that are surprising. For instance, right away I noticed that PowerShell uses the same old telnet client that Windows 95 used. It's horrible. Especially with copy/paste. You have to go under the main menu, and select a "Mark" function, then select your text (which doesn't select line by line, it selects by cursor position). You have to go under the menu to do the Copy and Paste functions as well (no keyboard shortcuts that I know of). Simply archaic in my opinion.

On the flip side, SSH is extremely versatile and flexible. And here's why. First, you can use ANY SSH client you want. Personally, I use PuTTY. It's very lightweight, powerful, and has the features that work for me. Copy and paste is very efficiently done. Simply select the text (which is intelligent enough to select line by line, not by cursor position), and the text is automatically copied to the clipboard. Simply clicking the right mouse button (or center mouse button/wheel in Linux) will paste at the cursor position. I use this all of the time for editing documents in a shell, very very easy and powerful. This behavior is also done at the text terminal of Linux as well, with the "gdm" service on (allows the mouse to be used in the text terminal).

Another feature that I love with SSH is tunneling. It's basically a lightweight feature which allows access to TCP ports of machines inside the network of the SSH server. Local ports can be forwarded to remote ports. Works great for basic applications. The beauty of mapping these ports is that all traffic is tunneled through the SSH connection, which is all encrypted.

Tab completion in Bash is better in my opinion. You get a list of matching entries in Bash (by pressing Tab twice), so that you can type and narrow down to which command you want. PowerShell works the same as the old "command" prompt in Windows, where you have to subsequently press tab to scroll through each command one at at time to get the one you want. If you miss the one you want, you have to scroll through the entire list of matches again. In a list of more than 5 matches or so, it takes more time to use tab completion in PowerShell than it does to just try to look elsewhere.

These are very basic level observations with usability. There's a lot more to each shell once you dig into them more and what goes on in each.

Topic: Open Source

Chris Clay

About Chris Clay

After administering Linux and Windows for over 17 years in multiple environments, my focus of this blog is to document my adventures in both operating systems to compare the two against each other. Past and present experiences have shown me that Linux can replace Windows and succeed in a vast variety of environments. Linux has proven itself many times over in the datacentre and is more than capable for the desktop.

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

26 comments
Log in or register to join the discussion
  • What about stuff like history handling (!command, !! and so on?), lists, extglobs?
    lightpriest
    • Polissage des dents

      The Equus blanchir les dents 3160 Innova ABS could be the all in you backlit screen along with the LED display, this attribute facilitate to convey the readiness connected with emission. It will maintain updated within the condition of the particular vehicle. The "access in order to Repair Solutions" present comprehensive solution considering to why the particular "check engine" present activate. The complete analysis and improved survive records assist to quickly establish the method to obtain the trouble.The reason for using Equus 3160 Innova ABS + Professional CanOBD2 diagnostic Code Scanner The Equus 3160 Innova ABS + Professional CanOBD2 diagnostic Code Scanner is usually an incredibly helpful tool in case you have the correct automobile. blanchiment des dents It offer generic codes and more from numerous helps make but on european, Korean or Swedish autos don't expect much more than the commonly used codes.The Equss 2160 Innova ABS works with with car vendor as Acura, Honda, Alfa Romeo, Audi, Chrysler, Ford, Geo, GM, Honda, Hyundai, Infiniti, Isuzu, Jaguar, Kia, territory Rover, Lexus, Mazda, Mercedes Benz, Mitsubishi, machine, Porsche, Saab, Saturn, Subaru, Suzuki, Toyota, Volkswagon, in addition to Volvo. For other vehicle brand, please check with your vehicle's program manual.Polissage des dents
      chengray123
  • lightpriest : Thank you for the comment, and for jogging my memory, I was going to mention the history and it slipped my mind. I was surprised to close a PowerShell window, then to go back in and repeat a few commands I had done earlier in the day. There were all gone! It was about that time that I recalled the PowerShell is using the same old command window from Windows 95. Linux shells (for those that don't know) keep a long history of commands and this can even be searched with a CTL-R. Here's a Bash reference page to give everybody an idea of what sort of functionality it has. It's an extremely powerful shell, which probably explains why it has been around so long: it's hard to perfect something that works so well.
    Chris_Clay
  • The Bash reference page is:

    http://linuxhelp.blogspot.com/2005/08/bash-shell-shortcuts.html

    Forgot that comments don't allow HTML...
    Chris_Clay
  • > It's horrible. Especially with copy/paste
    If you go into the Properties of the command window, on the Options Tab, check the QuickEdit Mode.

    > you have to subsequently press tab to scroll through each command one at at time
    Check out "powertab". It is an addon for powershell that makes it work a lot more like Bash command-completion.
    http://thepowershellguy.com/blogs/posh/archive/tags/PowerTab/default.aspx
    LazerPotatoe
  • You got it all wrong. PowerShell is just a shell, the read-evaluate-print loop can be hosted by any environment just like bash. The regular "command prompt" indeed has support for "quick" cut-n-paste. Much more so in the PowerShell integrated scripting environment (ISE) which is a full-featured graphical environment with both scripting tabs, interactive prompt and interactive source level debugging.

    It is also suspicious how you choose to focus on fringe topics (which has nothing to do with the shell) and completely ignore the powerfull PS features. Did you even take a look at PS remote administering support (remote commands, remote sessions and remote jobs)? It lets you seamlessly administer remote computers, issue powershell cmdlets, scripts etc. without even being concerned with SSH like functionality (which is *also* supported by PS).
    honeymonster
  • honeymonster : Does ISE give you total control of a remote system (such as browsing the filesystem)? Or how about edit a file on the remote system? My point is, using SSH is like directly logging on to the remote system, you have total access for complete system administration. Powershell is an add-on, that interfaces with Windows, where scripts need to be written to access certain things and there is still a layer between your client and the actual root operating system.

    My focus on the statements were on Powershell right out of the box. Sure, you can install an add-on for this, and an add-on for that. But when Microsoft releases patches for Powershell, do those add-ons all continue to work? What about upgrading Powershell to a newer version?

    SSH is much much simpler by design, and taking advantage of the Bash shell in this example, gives you complete and direct access to the operating system.
    Chris_Clay
  • I give up using Windows shells years ago. On every Windows computer in our company we installed Cygwin: http://www.cygwin.com/ which enables you to use Unix/Linux commands. I also like to install vim editor: http://www.vim.org/download.php#pc
    With this too software I can use Linux commands on Windows just like I would use Linux command on Linux.

    I always do the following:
    1. open file with vim editor
    2. write bash command script
    3. write simple Windows batch file (myfile.bat) with the following two commands:
    dos2unix myfile.sh
    bash myfile.sh
    4. I create a schedule task to myfile.bat file.

    When ever I edit sh file I am 100% sure that file was converted to Unix file when I execute Windows batch.

    My suggestion is: If you are used to Unix/Linux bash commands don't waste time with Windows Power Shell, just use Cygwin. And one more advantage if you someday migrate your Windows system to Linux all your scripts will already be working.
    grofaty@...
  • >Does ISE give you total control of a remote system (such as browsing the filesystem)?

    Yes. You can open a remote "tab" which essentially is just like SSH - only with less configuration if you want to auto-authenticate with your current credentials. Once there you can navigate the file system just like the local file system. Commands are issued remote and results are marshaled back to your primary console.

    But you can also opt to use a remote session. This lets you step into and out from and back into the remote. Think suspend the SSH connection, bg, and bring it to the foreground again, only reliable (i.e. with no risk of losing pending IO).

    PowerShell right out of the box has ISE. I am surprised you didn't notice that. No add-ons necessary.

    >Or how about edit a file on the remote system?
    Yes, you can manipulate files, content, etc. Now, can you start a GUI app and have it display locally? No. If that's what you want you really should compare SSH to RDP. That has nothing to do with the command shell.

    With PowerShell I can collect performance for processes from a number of computers by typing:
    icm -computer host1,host2,host3 {ps}
    The result will be a list of all processes running on all of the hosts with a nice column for each process which tells me from which host it came. The command will execute simultaneously on all hosts and will only complete when all results have been collected. How do you do that with bash?
    honeymonster
  • honeymonster : I've experienced problems when running certain commands in Powershell in the fashion you mention. For instance, there are known issues when running "xcopy" in Powershell on a remote system, even though it can be run locally without problems. To me this seems to be an issue with Windows not having a native shell tied closely enough to the operating system, but that's just my perception. I've never found a way to easily edit a remote file like I can in SSH by using "nano" or "vim", etc. which are very powerful remote editing utilities. Does Windows have a text-based file editing utility? This is one thing that I do very frequently in Linux. The thing that also bugs me about Windows is that a lot of files are in proprietary format so text editing/viewing utilities are worthless when trying to view event logs for example, etc.

    "With PowerShell I can collect performance for processes from a number of computers by typing:
    icm -computer host1,host2,host3 {ps}
    The result will be a list of all processes running on all of the hosts with a nice column for each process which tells me from which host it came. The command will execute simultaneously on all hosts and will only complete when all results have been collected. How do you do that with bash?"

    In order to list processes from multiple systems simultaneously, I would open up an SSH session to each system, view them side by side, and use the "ps" command on each system, or "top" which is the realtime process viewing utility.
    Chris_Clay
  • Windows telnet is a standalone application that ships as part of the OS. PowerShell has nothing to do with it except to launch it, just as you would from the DOS shell, an icon, the Start|Run menu, or any other way. The same way that an SSH/telnet client has nothing to do the bash/korn/etc shells. Comparing Windows telnet to an ssh client (and you don't say which ssh client) in a review of a command shell is irrelevant. And then to say that because Windows telnet is not good PowerShell is limited is just silly.

    It almost sounds like your using the term ssh and bash interchangeably, which is wrong and confusing to the reader. You also obviously haven't used PowerShell enough to understand the benefits of working with objects instead of strings. That's common for experienced scripters looking at PowerShell for the first time, and forgiveable. It is the only forgiveable part of this article, unfortunately.

    I'm guessing ZDNet UK doesn't have technical editors reviewing content before it's posted. Usually I just ignore and move on from bad articles, but the complete wrongness of this one got me so annoyed I had to comment.
    monahancj
  • Forgot one point.
    ".. where you have to subsequently press tab to scroll through each command one at at time to get the one you want. If you miss the one you want, you have to scroll through the entire list of matches again."

    Shift+Tab goes backwards. Before you say can't say "I don't know of a way" or "I don't think you can".
    monahancj
  • ChrisZDNetUK :

    "Comparing Windows telnet to an ssh client (and you don't say which ssh client) in a review of a command shell is irrelevant".

    Actually I was comparing "command.exe" which seems to be the actual app used by the basic Powershell application itself, to Bash. Probably a mistake on my end, I should have mentioned "command.exe" rather than "telnet". I say this because the basic Powershell interface has the same menus and everything as the Command application in Windows. SSH clients are similar, my focus is on the SSH protocol and its connectivity to a remote system to allow a seamless connection. The actual SSH client is a little outside of the scope here.

    "It almost sounds like your using the term ssh and bash interchangeably, which is wrong and confusing to the reader."

    I use them in combination because this is the solution to provide a remote shell on a Linux system. Same as with Powershell, again, a remote shell solution.

    "You also obviously haven't used PowerShell enough to understand the benefits of working with objects instead of strings. "

    You are correct. The focus is administration of a remote system as if I was directly on that system, and having a remote shell in comparison, as well as overall usability. Not learning the extra layer of Powershell's object scripting and commands necessarily. I suppose you could say that I should have compared Powershell locally and remotely which would be a valid argument.
    Chris_Clay
  • "Shift+Tab goes backwards. Before you say can't say "I don't know of a way" or "I don't think you can"."

    Thanks for the tip and a good point. Personally, I find it more useful where Bash gives you a complete list so that you can simply continue to type the matching pattern, then hit Tab again to see what additional matches you get, allowing you to narrow down to whichever one you want. Scrolling through a list one line at a time to me is counterproductive. What if you have 50 matches? Are you going to scroll 50 individual lines trying to narrow down wich one you are looking for? But this is just my opinion.
    Chris_Clay
  • > I've experienced problems when running certain commands in Powershell in the fashion you mention.
    Citation needed. Anyway, there's a proper command for that: Copy-Item. It has an alias: copy. Type "help copy" next time you open PowerShell (CLI or ISE). Please note that Copy-Item is generalized and will copy *any* type of item - not just files or folders. I.e. if you step into the registry, certificate store, or any 3rd party PsDrive provider (e.g. SQL server, VMWare etc) it will work the same.

    >Does Windows have a text-based file editing utility?

    No, not built-in. Nothing to do with PowerShell, though. Relevance? I will use PowerShell to script the local system or remote systems. You bring in SSH (as if that's part of bash?) and fails to recognize that those are orthogonal issues. Telnet works on Windows, too.

    But when you try to diss PowerShells remoting capabilities by referring to SSH you really just display your ignorance about PowerShell and the distinction between remote channels (ssh) and command line interpreters. As Chris said, you mix the terms.

    Quite frankly, PowerShells remote admin capabilities blows bash/ssh out of the water. I gave you an example above how PS supports "fan out" remoting - simultaneous execution on several machines. Here's another:
    icm host1,host2,host2 backup.ps1
    This will execute the backup.ps1 script 3 hosts simultaneously. It need not exist on the remote computers.

    How do ssh+bash handle remote jobs? Want to execute a script on a remote computer but as a job which you can control from your local console?
    icm host1 backup1.ps1 -asjob

    You see - you rarely need to actually "jump" to the remote computer. You can just issue commands. Makes ssh look utterly dated...
    honeymonster
  • "> I've experienced problems when running certain commands in Powershell in the fashion you mention.
    Citation needed."

    Here's a similar issue to the one mentioned in this thread:

    http://stackoverflow.com/questions/1773108/powershell-ise-appears-to-hand-with-interactive-commands

    It's also mentioned in this thread that "Interactive console applications are not supported in ISE". This is limitation in my opinion, if this is correct.

    "But when you try to diss PowerShells remoting capabilities by referring to SSH you really just display your ignorance about PowerShell and the distinction between remote channels (ssh) and command line interpreters. As Chris said, you mix the terms."

    Well, my general focus was with remote administration using a command line, based on common tasks that I handle. On Linux, I would use SSH with the Bash shell. On Windows, I would use Powershell. This is the basis for my comparison. The example that prompted me to put up the article was with remote administration of two mail servers, one with Exchange using the Exchange Management Shell (Powershell), and a Linux Sendmail server using SSH/Bash. Everybody will use different tools depending on preference. Overall, I find Powershell more clumsy as a whole for remote administration, than I do SSH/Bash for remote administration.

    I guess you have to step back and ask yourself what types of admin tasks you commonly handle. Commonly, I need to edit text files on a remote system, or do a simple find/replace in them. We've admitted here there's no easy way to view/edit files directly in Powershell. Another one even more frequently is to view logs. Viewing logs will vary in Windows, depending on which log(s) you need to view (i.e. Event Log, IIS log, etc.). I find it cumbersome having to use different Powershell utilities to view different logs, where on a Linux server all logs are in text format so one tool can be used. This however is getting out of the scope.

    I also re-read ChrisZDNetUK's comment : "Comparing Windows telnet to an ssh client (and you don't say which ssh client) in a review of a command shell is irrelevant".

    Well, I admit I should have mentioned "command.exe" instead of telnet in my original article. I was comparing a Powershell window to a PuTTY window in that example.
    Chris_Clay
  • "We've admitted here there's no easy way to view/edit files directly in Powershell"

    PS> Invoke-Item \\servername\C$\path\logfilename.txt
    The above command should open the remote file in notepad (using the default text editor application). This uses the adminstrative file share for the C drive. You need to have admin rights on the server.


    PS> Get-EventLog -LogName System -EntryType Error -Newest 5 -computerName "MY_SERVER_NAME"
    The above command will show the latest 5 error events from the System log.


    Also, you can use the command Select-String in a similar way to grep. I don't think it can do search and replace however. But you could write a simple script.

    Sorry -- I know you're trying to hate Powershell -- but it's actually pretty slick. I am still a big fan of Linux and Perl though.

    Best Regards
    LazerPotatoe
  • In my personal opinion articles like these do not belong on the web. I am not really sure how these 5 paragraphs were even published.

    The article makes a grand statement that it is comparing two products, however the article covers such a small subset of the overall functionality that it provides very little (if any) value.

    The best comparison I can think of for this article is as follows:
    Comparing two cars and talking of the limitations of one of the cars and then just comparing how the windscreen wiper controller levers and the indicators work. Without considering the Engine, the Body, the Efficiency, the Interior, the Performance, the Purpose etc etc etc.

    In short this article is one of the shallowest articles I have ever read.
    anonymous
  • > In short this article is one of the shallowest articles I have ever read.
    Agreed. And what little substance it has; it got mostly wrong, like failing to observe the difference between channel (ssh) and processor (bash/powershell).
    honeymonster
  • apexwm wrote (15 October, 2010):
    > Commonly, I need to edit text files on a remote system,
    > or do a simple find/replace in them. We've admitted here there's no easy way
    > to view/edit files directly in Powershell.

    The point that others have made is that you don't need to edit remotely because you can edit locally (using vim OR something as fancy as ISE) and run on any host, seamlessly. Anyways it seems to me that's even better than what ssh supports.

    I say this despite having been pro-Linux and anti-Windows for years... but Windows has come a long way. And I had to smile when I saw the help system in Powershell; clearly borrowed from Unix!
    schollii