Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. I wish I liked Powershell

I wish I liked Powershell

Scheduled Pinned Locked Moved The Lounge
csharpwindows-adminlinux
27 Posts 17 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kiriander

    I disagree with "never seen another car". You're still claiming it's objectively worse. The thing is, I know exactly how you feel! Heck, my muscle memory makes me sometimes work faster when I shell down to CMD and do something there. I know how you feel! It's just that PS isn't objectively worse, like your french car. It's very different, but it's cool. By now, it's clear that you haven't attempted giving PS a chance. You haven't built complex pipes in Bash & PS (well, you may have in Bash but you surely haven't in PS). You haven't tried reading complex PS scripts. All that different stuff serves a purpose, it helps getting things done! It's not only internally consistent, it's very logical once you give it a chance. Which you don't. Speaking of which, why aren't you worried about CMD? It's installed by default, anyone can use it and you sure as hell can, with some effort, do really complex stuff there. Why aren't you worried about VBS? It's ability to call C-like APIs is limited (read: non-existant), but a heap ton of Windows is accessible through COM thus through VBS (well, technically, a COM-object isn't VBS-callable by default, it needs to support IDispatch while COM only requires IUnknown, but MS are pretty good at supporting administration through VBS). Speaking of administration, WMI is installed by default as well. But it's only PS that worries you. Of course. PS: at the beginning of this discussion, C# was mentioned. Now it's Python. The thing is, C# is, syntactically, way more similar to PS than it is to Python. This isn't an objective discussion, isn't it?

    P Offline
    P Offline
    pmauriks
    wrote on last edited by
    #16

    Of course. You are entitled to your opinion. That you surmised so much about my previous programming experiences, and leapt to the conclusion I wasn't worried about alternative technologies. . .

    Kiriander wrote:

    This isn't an objective discussion, isn't it?

    You said it yourself. . . or did you, since it is a double negative.

    1 Reply Last reply
    0
    • P Phil Benson

      I hate it.... Try writing decent functions where you explicitly define a return value / object and it gets metamorphasied into a PSObject... The only way I found to *always* get what you asked for was (for example) return , VariableContainingObjectToBeReturned Notice the comma after return and before the variable. Even explicitly casting the varaible to something does not always work... Another Pet Peave is the fact that if you do not explicitly assign a varible as a return object from a Function (within a function), or pipe a functions return values to null (| Out-Null) it Elephants-Up the expected return value as well...

      Who the f*** is General Failure, and why is he reading my harddisk?

      J Offline
      J Offline
      Jan Holst Jensen2
      wrote on last edited by
      #17

      Or try to do consistent quoting to pass parameters to an external executable. It's mind-blowing that a fundamental feature for a scripting language - interfacing to other commands - is so complicated. I have in some instances ended up passing parameters to batch files as environment variables. That works reliably. And then there was the lovely incident with invisible files in an earlier version of PS. I called out to a batch file that created files on a network drive. Unfortunately, when I returned to PS the files were invisible until PS was restarted. Not a happy experience, when the PS was supposed to process backup files produced by the batch file. Caused me a good deal of lost hours - and backups! And yes, the function return value mystery. Who ever thought that was a good idea ? I have really tried to like PowerShell. It feels like it should be a major step up from MS-DOS scripting with proper flow control, error handling, etc. But now I try to stay away from it, as it usually ends up eating my time, especially when I need to make it talk to existing scripts. One success story: I did a PS script that read a file and processed it via a .NET library. That was easy, clear code, and no surprises.

      P 1 Reply Last reply
      0
      • J Jan Holst Jensen2

        Or try to do consistent quoting to pass parameters to an external executable. It's mind-blowing that a fundamental feature for a scripting language - interfacing to other commands - is so complicated. I have in some instances ended up passing parameters to batch files as environment variables. That works reliably. And then there was the lovely incident with invisible files in an earlier version of PS. I called out to a batch file that created files on a network drive. Unfortunately, when I returned to PS the files were invisible until PS was restarted. Not a happy experience, when the PS was supposed to process backup files produced by the batch file. Caused me a good deal of lost hours - and backups! And yes, the function return value mystery. Who ever thought that was a good idea ? I have really tried to like PowerShell. It feels like it should be a major step up from MS-DOS scripting with proper flow control, error handling, etc. But now I try to stay away from it, as it usually ends up eating my time, especially when I need to make it talk to existing scripts. One success story: I did a PS script that read a file and processed it via a .NET library. That was easy, clear code, and no surprises.

        P Offline
        P Offline
        Phil Benson
        wrote on last edited by
        #18

        Jan Holst Jensen2 wrote:

        One success story: I did a PS script that read a file and processed it via a .NET library. That was easy, clear code, and no surprises.

        Defeats the purpose really of having a "shell code" if you have to wrap .Net calls to get anything done... :laugh:

        Who the f*** is General Failure, and why is he reading my harddisk?

        Who the F*** is general failure and why is he reading my hard drive?

        1 Reply Last reply
        0
        • H honey the codewitch

          It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

          Real programmers use butterflies

          M Offline
          M Offline
          MikeTheFid
          wrote on last edited by
          #19

          Totally agree and I am experiencing your pain. I haven't been able to find a decent book or tutorial that clears away the fog. It's like "unable to grok" was the highest design goal; followed closely by "unable to remember". So I rely on examples colleagues have written and live in hope that one day a beam of sunlight will break through the clouds. That and continuing to gain experience out of shear stubbornness! :)

          Cheers, Mike Fidler "I intend to live forever - so far, so good." Steven Wright "I almost had a psychic girlfriend but she left me before we met." Also Steven Wright "I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.

          1 Reply Last reply
          0
          • H honey the codewitch

            It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

            Real programmers use butterflies

            O Offline
            O Offline
            obermd
            wrote on last edited by
            #20

            Every time I look at PS I feel like I'm looking at bastardized Perl.

            R 1 Reply Last reply
            0
            • H honey the codewitch

              It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

              Real programmers use butterflies

              M Offline
              M Offline
              MikeTheFid
              wrote on last edited by
              #21

              If it was hard to create, it ought to be hard to use! ;) Seriously, I totally get your frustration. Stubbornness comes in handy sometimes.

              Cheers, Mike Fidler "I intend to live forever - so far, so good." Steven Wright "I almost had a psychic girlfriend but she left me before we met." Also Steven Wright "I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.

              1 Reply Last reply
              0
              • H honey the codewitch

                It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

                Real programmers use butterflies

                M Offline
                M Offline
                MSBassSinger
                wrote on last edited by
                #22

                I have not updated this in 6 years, but it shows how to execute C# written as script. How to Execute External Uncompiled C# Code[^] and thus just use C# scripts to do something, instead of whatever the heck PowerShell is.

                1 Reply Last reply
                0
                • H honey the codewitch

                  It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

                  Real programmers use butterflies

                  R Offline
                  R Offline
                  raddevus
                  wrote on last edited by
                  #23

                  It's fascinating to read the comments about how so many devs feel this way about PS language. I feel the same way. It's ugly, it's forgetable, it just feels forced. Glad I'm not alone in this.

                  1 Reply Last reply
                  0
                  • O obermd

                    Every time I look at PS I feel like I'm looking at bastardized Perl.

                    R Offline
                    R Offline
                    raddevus
                    wrote on last edited by
                    #24

                    obermd wrote:

                    I feel like I'm looking at bastardized Perl

                    I am commiserating along with everyone about how ugly the PS language is and then I see your comparison to Perl and I'm like, "Oh, no, PS is all fine and good and maybe even beautiful after all. I mean, it's not Perl." :laugh: :laugh: Perl syntax just gives me shivers. :laugh:

                    1 Reply Last reply
                    0
                    • H honey the codewitch

                      It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

                      Real programmers use butterflies

                      U Offline
                      U Offline
                      User 13224750
                      wrote on last edited by
                      #25

                      Our company got onboard with .NET in ~2000. When it came time to learn PowerShell many years ago (yes, 2.0) we had an instructor led class with a mix of developers & Windows and Linux Admins in it. Developers (me included at the time) seemed to get PS, while the Windows and Linux struggled with it. Linux admins especially since they are heavy duty scripting folks. Problem for them was it so very different than the shells they used on Linux. Fast forward to the present, those same Linux admins are using PowerShell and are quite good at it. Syntax always seemed a bit "clunky" to me, but the concepts were quite natural to me because of leaning .NET and C#.

                      1 Reply Last reply
                      0
                      • H honey the codewitch

                        It seems so useful, i just can't stand the syntax. I couldn't even tell you why except I can't get my head around it. Just give me C# or something with a Shell object.

                        Real programmers use butterflies

                        T Offline
                        T Offline
                        thorne999
                        wrote on last edited by
                        #26

                        The problem is time. I just don't have the time to learn such an obtuse syntax. Why didn't they just use C#. Given enough time we can learn anything, but actually we are never given enough time to completely learn anything. PS is yet another time sink. BTW the folks who made the comments about French cars were right, the question is WHY do the French insist on swimming up stream when the large majority of uses are intuitive and the French standard is not. Oh wait, was I discussing PS or French cars? Hummmmmm, I think both.

                        H 1 Reply Last reply
                        0
                        • T thorne999

                          The problem is time. I just don't have the time to learn such an obtuse syntax. Why didn't they just use C#. Given enough time we can learn anything, but actually we are never given enough time to completely learn anything. PS is yet another time sink. BTW the folks who made the comments about French cars were right, the question is WHY do the French insist on swimming up stream when the large majority of uses are intuitive and the French standard is not. Oh wait, was I discussing PS or French cars? Hummmmmm, I think both.

                          H Offline
                          H Offline
                          honey the codewitch
                          wrote on last edited by
                          #27

                          thorne999 wrote:

                          The problem is time. I just don't have the time to learn such an obtuse syntax. Why didn't they just use C#. Given enough time we can learn anything, but actually we are never given enough time to completely learn anything. PS is yet another time sink.

                          All of my this. :) ETA: It reminds me of SQL/DML/SML??? whatever the last one was called. They syntax is ridiculous and I find I have to go back to the reference way too much.

                          Real programmers use butterflies

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups