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. Stories Behind the Tech:PowerShell

Stories Behind the Tech:PowerShell

Scheduled Pinned Locked Moved The Lounge
comwindows-admin
18 Posts 8 Posters 9 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.
  • R Offline
    R Offline
    raddevus
    wrote on last edited by
    #1

    Adam Gordon Bell is a great podcaster who investigates the stories behind the code. I've enjoyed a great many of his podcasts. This one, where he interviews Jeffrey Snover (creator of PowerShell) is fantastic. Navigating Corporate Giants Jeffrey Snover and the Making of PowerShell - CoRecursive Podcast[^] Snover reveals interesting details that, I believe, will open your eyes to why Microsoft has backed certain technologies then left them for dead. Really great insider stuff you're not going to hear anywhere else. The podcast is also available via Apple Podcasts. Listent to it while you're working & I'm guessing you'll stop working to focus on it more. :rolleyes:

    K K D R 4 Replies Last reply
    0
    • R raddevus

      Adam Gordon Bell is a great podcaster who investigates the stories behind the code. I've enjoyed a great many of his podcasts. This one, where he interviews Jeffrey Snover (creator of PowerShell) is fantastic. Navigating Corporate Giants Jeffrey Snover and the Making of PowerShell - CoRecursive Podcast[^] Snover reveals interesting details that, I believe, will open your eyes to why Microsoft has backed certain technologies then left them for dead. Really great insider stuff you're not going to hear anywhere else. The podcast is also available via Apple Podcasts. Listent to it while you're working & I'm guessing you'll stop working to focus on it more. :rolleyes:

      K Offline
      K Offline
      Kent Sharkey
      wrote on last edited by
      #2

      :thumbsup: Or at the very least, read the transcript. Jeffrey Snover is amazing (even if I hate PowerShell)

      TTFN - Kent

      R 1 Reply Last reply
      0
      • K Kent Sharkey

        :thumbsup: Or at the very least, read the transcript. Jeffrey Snover is amazing (even if I hate PowerShell)

        TTFN - Kent

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

        Kent Sharkey wrote:

        (even if I hate PowerShell

        I haven't been a big fan either, but... 1. I can run powershell scripts on my Linux box (Ubuntu 22.04.4 LTS). Kind of amazing 2. When you listen to the podcast (and I know you will) then you will see that for a Windows Admin it is the only solution (so you have to love it if you're over there). You'll discover why that is in the podcast & your head will probably explode (if you didn't already know why) 3. There are some things you can do with PowerShell which are fun, here's one now: Insert gratuitous personal self-promotion here Generate a SHA256 for any input text:

        param (
        [string]$target = $(Read-Host)
        )
        $stringAsStream = [System.IO.MemoryStream]::new()
        $writer = [System.IO.StreamWriter]::new($stringAsStream)
        $writer.write($target)
        $writer.Flush()
        $stringAsStream.Position = 0
        $outHash = Get-FileHash -InputStream $stringAsStream | Select-Object Hash
        $outHash.hash.ToLower()

        Run it like this:

        $ pwsh "this is my string I want to hash"

        Oh, wait that is from my most recent article[^]. :rolleyes:

        P 1 Reply Last reply
        0
        • R raddevus

          Adam Gordon Bell is a great podcaster who investigates the stories behind the code. I've enjoyed a great many of his podcasts. This one, where he interviews Jeffrey Snover (creator of PowerShell) is fantastic. Navigating Corporate Giants Jeffrey Snover and the Making of PowerShell - CoRecursive Podcast[^] Snover reveals interesting details that, I believe, will open your eyes to why Microsoft has backed certain technologies then left them for dead. Really great insider stuff you're not going to hear anywhere else. The podcast is also available via Apple Podcasts. Listent to it while you're working & I'm guessing you'll stop working to focus on it more. :rolleyes:

          K Offline
          K Offline
          kmoorevs
          wrote on last edited by
          #4

          raddevus wrote:

          Listent to it while you're working & I'm guessing you'll stop working to focus on it more

          :thumbsup: Yep! You were correct! That was an interesting interview. I've bookmarked for future use. Thanks for sharing! :)

          "Go forth into the source" - Neal Morse "Hope is contagious"

          R 1 Reply Last reply
          0
          • K kmoorevs

            raddevus wrote:

            Listent to it while you're working & I'm guessing you'll stop working to focus on it more

            :thumbsup: Yep! You were correct! That was an interesting interview. I've bookmarked for future use. Thanks for sharing! :)

            "Go forth into the source" - Neal Morse "Hope is contagious"

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

            Glad to hear others enjoyed it as much as I did. :thumbsup:

            1 Reply Last reply
            0
            • R raddevus

              Kent Sharkey wrote:

              (even if I hate PowerShell

              I haven't been a big fan either, but... 1. I can run powershell scripts on my Linux box (Ubuntu 22.04.4 LTS). Kind of amazing 2. When you listen to the podcast (and I know you will) then you will see that for a Windows Admin it is the only solution (so you have to love it if you're over there). You'll discover why that is in the podcast & your head will probably explode (if you didn't already know why) 3. There are some things you can do with PowerShell which are fun, here's one now: Insert gratuitous personal self-promotion here Generate a SHA256 for any input text:

              param (
              [string]$target = $(Read-Host)
              )
              $stringAsStream = [System.IO.MemoryStream]::new()
              $writer = [System.IO.StreamWriter]::new($stringAsStream)
              $writer.write($target)
              $writer.Flush()
              $stringAsStream.Position = 0
              $outHash = Get-FileHash -InputStream $stringAsStream | Select-Object Hash
              $outHash.hash.ToLower()

              Run it like this:

              $ pwsh "this is my string I want to hash"

              Oh, wait that is from my most recent article[^]. :rolleyes:

              P Offline
              P Offline
              Peter_in_2780
              wrote on last edited by
              #6

              echo "this is my string I want to hash" | sha256sum

              Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

              D R P 3 Replies Last reply
              0
              • P Peter_in_2780

                echo "this is my string I want to hash" | sha256sum

                Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                D Offline
                D Offline
                Derek Hunter
                wrote on last edited by
                #7

                When I sit in front of a bash shell prompt I feel the entire computer spread out in front of me. When I sit in front of a Powershell prompt I feel like I'm peeking through a tiny hole into a big confusing mess. The first Microsoft PC I used had 640K of memory and twin floppy disks. It felt like an amusing toy next to the Sun Microsystems workstation on my desk. Forty years later it still f*****g does!

                R 1 Reply Last reply
                0
                • P Peter_in_2780

                  echo "this is my string I want to hash" | sha256sum

                  Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

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

                  That's a really interesting shell command I had never seen. Unfortuantely, it is actually not quite generating the correct sha256 hash. I had to prove it to myself first. I tried:

                  $ echo "aardvark" | sha256sum

                  You get the value: aabbc5c9b7ec8ef2facd0dbee5b3f7f8836b53544583c21894d25ca4cf98a188 That's incorrect. The correct value is: cf9c1cb89584bf8c4176a37c2c954a8dc56077d3ba65ee44011e62ab7c63ce2d Independent Hash Creator: VirusTotal As a way to prove this I created a file (aardvark.txt) with the word aardvark but no line terminator or file terminator in it and uploaded it to VirusTotal (runs a sha256 on every file it receives) and you can see that it confirms the same output that I get from my PowerShell script at this link[^]. If you look at the top of that page you'll see the value of the word aardvark which is: cf9c1cb89584bf8c4176a37c2c954a8dc56077d3ba65ee44011e62ab7c63ce2d The problem with the script you've provided is that it seems to include a \n with the txt that is hashed. Here's a snapshot of me trying your values[^] and then inputting the value of my aardvark.txt file (which includes no file terminator or line terminator to your script. I hope you find this as interesting as I do. :thumbsup:

                  P 1 Reply Last reply
                  0
                  • P Peter_in_2780

                    echo "this is my string I want to hash" | sha256sum

                    Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                    P Offline
                    P Offline
                    Peter Adam
                    wrote on last edited by
                    #9

                    Is sha256sum a Bash internal command or something you have to install? If the latter, you can do it in Windows without piping and installing anything, and more: [Windows: MD5/SHA256 CheckSum - Built-In Utility - ShellHacks](https://www.shellhacks.com/windows-md5-sha256-checksum-built-in-utility/)

                    P R 2 Replies Last reply
                    0
                    • R raddevus

                      That's a really interesting shell command I had never seen. Unfortuantely, it is actually not quite generating the correct sha256 hash. I had to prove it to myself first. I tried:

                      $ echo "aardvark" | sha256sum

                      You get the value: aabbc5c9b7ec8ef2facd0dbee5b3f7f8836b53544583c21894d25ca4cf98a188 That's incorrect. The correct value is: cf9c1cb89584bf8c4176a37c2c954a8dc56077d3ba65ee44011e62ab7c63ce2d Independent Hash Creator: VirusTotal As a way to prove this I created a file (aardvark.txt) with the word aardvark but no line terminator or file terminator in it and uploaded it to VirusTotal (runs a sha256 on every file it receives) and you can see that it confirms the same output that I get from my PowerShell script at this link[^]. If you look at the top of that page you'll see the value of the word aardvark which is: cf9c1cb89584bf8c4176a37c2c954a8dc56077d3ba65ee44011e62ab7c63ce2d The problem with the script you've provided is that it seems to include a \n with the txt that is hashed. Here's a snapshot of me trying your values[^] and then inputting the value of my aardvark.txt file (which includes no file terminator or line terminator to your script. I hope you find this as interesting as I do. :thumbsup:

                      P Offline
                      P Offline
                      Peter_in_2780
                      wrote on last edited by
                      #10

                      We both forgot to put echo -n to suppress the trailing newline.

                      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                      R 1 Reply Last reply
                      0
                      • P Peter_in_2780

                        We both forgot to put echo -n to suppress the trailing newline.

                        Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

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

                        Thanks, I could not figure out how to get the correct output using that new shell command. :thumbsup: -n For The Win!!!

                        1 Reply Last reply
                        0
                        • P Peter Adam

                          Is sha256sum a Bash internal command or something you have to install? If the latter, you can do it in Windows without piping and installing anything, and more: [Windows: MD5/SHA256 CheckSum - Built-In Utility - ShellHacks](https://www.shellhacks.com/windows-md5-sha256-checksum-built-in-utility/)

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

                          It is a (built-in) bash shell command (at least here on Ubuntu 22.04.4). I just tried the certutil on my windows machine and had it generate a SHA256 of my aardvark.txt file and it worked great.

                          certutil -hashfile aardvark.txt SHA256
                          SHA256 hash of aardvark.txt:
                          cf9c1cb89584bf8c4176a37c2c954a8dc56077d3ba65ee44011e62ab7c63ce2d

                          Thanks for the insight into that one. Really great.:thumbsup:

                          1 Reply Last reply
                          0
                          • P Peter Adam

                            Is sha256sum a Bash internal command or something you have to install? If the latter, you can do it in Windows without piping and installing anything, and more: [Windows: MD5/SHA256 CheckSum - Built-In Utility - ShellHacks](https://www.shellhacks.com/windows-md5-sha256-checksum-built-in-utility/)

                            P Offline
                            P Offline
                            Peter_in_2780
                            wrote on last edited by
                            #13

                            It's not a bash builtin, but it is provided by a standard (default install) package.

                            Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                            R 1 Reply Last reply
                            0
                            • D Derek Hunter

                              When I sit in front of a bash shell prompt I feel the entire computer spread out in front of me. When I sit in front of a Powershell prompt I feel like I'm peeking through a tiny hole into a big confusing mess. The first Microsoft PC I used had 640K of memory and twin floppy disks. It felt like an amusing toy next to the Sun Microsystems workstation on my desk. Forty years later it still f*****g does!

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

                              Derek Hunter wrote:

                              When I sit in front of a bash shell prompt I feel the entire computer spread out in front of me. When I sit in front of a Powershell prompt I feel like I'm peeking through a tiny hole into a big confusing mess.

                              That is a very good way to express the feeling of sys admin in windows versus Linux. And, that is exactly what Jeffrey Snover literally fought the internal people at MS about. The other people were like, "no look you can move your mouse and do all that stuff". Snover was like, "Ok, so you have 100 machines that you need to set a value on as a sys admin and youre going to have the sys admin login to each box and move the mouse to set the value?!!!" It's a great interview.

                              1 Reply Last reply
                              0
                              • P Peter_in_2780

                                It's not a bash builtin, but it is provided by a standard (default install) package.

                                Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

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

                                Thanks for the clarity on that. I can never tell my built-ins from my packages in the ground. :laugh:

                                P 1 Reply Last reply
                                0
                                • R raddevus

                                  Adam Gordon Bell is a great podcaster who investigates the stories behind the code. I've enjoyed a great many of his podcasts. This one, where he interviews Jeffrey Snover (creator of PowerShell) is fantastic. Navigating Corporate Giants Jeffrey Snover and the Making of PowerShell - CoRecursive Podcast[^] Snover reveals interesting details that, I believe, will open your eyes to why Microsoft has backed certain technologies then left them for dead. Really great insider stuff you're not going to hear anywhere else. The podcast is also available via Apple Podcasts. Listent to it while you're working & I'm guessing you'll stop working to focus on it more. :rolleyes:

                                  D Offline
                                  D Offline
                                  dandy72
                                  wrote on last edited by
                                  #16

                                  The raw RSS feed, as God intended podcasts to be used: [CoRecursive: Coding Stories](https://corecursive.libsyn.com/feed)

                                  raddevus wrote:

                                  The podcast is also available via Apple Podcasts.

                                  Don't feed the beast.

                                  1 Reply Last reply
                                  0
                                  • R raddevus

                                    Adam Gordon Bell is a great podcaster who investigates the stories behind the code. I've enjoyed a great many of his podcasts. This one, where he interviews Jeffrey Snover (creator of PowerShell) is fantastic. Navigating Corporate Giants Jeffrey Snover and the Making of PowerShell - CoRecursive Podcast[^] Snover reveals interesting details that, I believe, will open your eyes to why Microsoft has backed certain technologies then left them for dead. Really great insider stuff you're not going to hear anywhere else. The podcast is also available via Apple Podcasts. Listent to it while you're working & I'm guessing you'll stop working to focus on it more. :rolleyes:

                                    R Offline
                                    R Offline
                                    Rick York
                                    wrote on last edited by
                                    #17

                                    That was interesting to read. Adam's interjections got a bit annoying but that's OK. I found one line in particular to be hilarious :

                                    Quote:

                                    I’ve never seen anybody use a GUI in a clever way. Ever. There’s no cleverness to it.

                                    "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                                    1 Reply Last reply
                                    0
                                    • R raddevus

                                      Thanks for the clarity on that. I can never tell my built-ins from my packages in the ground. :laugh:

                                      P Offline
                                      P Offline
                                      Peter_in_2780
                                      wrote on last edited by
                                      #18

                                      A couple of quick tricks: help -d will list all builtins with a (very) brief synopsis which _command_ will show the executable path for non-builtins Note that there are some that have a foot in both camps, for example printf (That one's a bitch - the builtin behaves subtly differently from the external program.) Just _command_ will run the builtin, specify a path to force the external one, like _/usr/bin/command_ . ...and of course type -a _command_

                                      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                                      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