Working With PowerShell Variables

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 31

  • @BeccaTheBoring
    @BeccaTheBoring 2 роки тому +5

    Thanks! I started watching to refresh my 15 year old training. Wasn’t expecting to find a new editor I actually like! ISE really wasn’t cutting it and I absolutely hate PyCharm! Thank you!

  • @sanghvian
    @sanghvian 4 роки тому +12

    This series is literally the best thing I've binged. Thanks so so SO much for such amazing videos and powerful documentation !!

  • @amritarongpipi2617
    @amritarongpipi2617 3 роки тому +1

    This tutorial is best ever with the combinations of video and blog.

  • @خالدعبدالله-ج7غ5ي
    @خالدعبدالله-ج7غ5ي 11 місяців тому +1

    Thank you that was awesome...

  • @kd_john8200
    @kd_john8200 4 роки тому +3

    This is one of the best explanation of PowerShell variables videos I have ever seen. Keep up the good work!

  • @Chris-tu8qd
    @Chris-tu8qd 5 років тому +8

    These videos are fantastic! Great job. You're a very skilled instructor.

  • @DrWho2008t101
    @DrWho2008t101 4 роки тому +1

    thanks for the video.

  • @aloisodipo8459
    @aloisodipo8459 2 роки тому

    The topics are good so far,but need to increase the fonts of the video for more visibility when using a phone.

  • @sawyerclendening8430
    @sawyerclendening8430 4 роки тому +1

    Awesome videos! I am trying to learn PowerShell to further my new IT career but I have 0 coding experience, so I do get little lost in the terminology of things like whats a string and how can I tell it apart in. But that's nothing little google can't help me with!

  • @pseudounknow5559
    @pseudounknow5559 3 роки тому

    Thats a very good video

  • @budcarr8673
    @budcarr8673 Рік тому

    Gr8 video !

  • @muhammadsajid2676
    @muhammadsajid2676 4 роки тому +1

    Thanks for the video. :-)

  • @BijouBakson
    @BijouBakson 2 роки тому

    Thank you.

  • @ashisharya65
    @ashisharya65 Рік тому

    What's the VS code extension you are using ?

  • @TotalWarriorLegends
    @TotalWarriorLegends 4 роки тому +1

    Are you also make an video how to begin with scripting and what are the basics and what is importent?

    • @Techthoughts2
      @Techthoughts2  4 роки тому

      Yes. This series has many episodes, and one is dedicated to scripting. Check out the whole playlist: ua-cam.com/play/PL2j0_s2VJe2hzQuQyn6yfMS2olhhs4UnQ.html

  • @isaacmaag1294
    @isaacmaag1294 2 роки тому

    A little confused with the beginning... Around 3:34 you said that It was so much more conveinent to use $processes when that is just as long as get-process... You still had to run two commands and type out the pipe plus the commands and so each example the time didn't change? Your first two commands were the same amount of time as the second two? Seems a little confusing.

    • @Techthoughts2
      @Techthoughts2  2 роки тому +1

      Its more convenient when your doing a lot of stuff with the data capture.
      When you run a command like the following:
      Get-Process
      ^ This is just a moment in time and you get the raw object return.
      If you want to sort the data a different way, you have to run Get-Process again
      if you only wanted info on one particular process, you have to run Get-Process again
      if you just wanted memory information, you have to run Get-Process again
      This is very expensive (Get-Process has to be run EACH TIME).
      Alternatively, you can run Get-Process once and then work with the data as much as you want:
      $processes = Get-Process
      $processes | Where-object {$_.Name -eq "notepad.exe"}
      $processes | Where-object {$_.CPU -gt 1000}
      $processes | Sort-Object WorkingSet64 -Descending
      $processes | Sort-Object -Descending CPU

  • @chris8534
    @chris8534 3 роки тому

    Hmmm.....if you put get-process into the variable so it only had to be loaded into memory once - true that is more efficient but won't that data in that variable go more and more out of date over time as the data is a snapshot of that command?

  • @mbahr6322
    @mbahr6322 2 роки тому

    Hi,
    can you please tell me the answer for the below question
    Which variable cannot be modified by the administrator?
    A)user created
    B)automatic
    C) preference
    D)pre-defined

  • @betenu1
    @betenu1 5 років тому

    Wouldn't be easier to pipe all the commands into one variable? I'm referring to the filedata example

  • @Johannes00
    @Johannes00 3 роки тому

    $foo = 1..5
    $foo
    1, 2, 3, 4, 5
    $bar = $foo -ge 2
    $bar
    2, 3, 4, 5
    $bar = $bar -le 4
    $bar
    2, 3, 4
    I'm very new to powershell and I don't know how to improve this with the pipeline but I'd like to use compound comparisons / conditionals?
    Tried doing $bar = ($foo -ge 2) -and ($foo -le 4), but this obviously returned a boolean which is not what I want.
    Goal is to check a list of ordered numbers and clamp the output, in this case, only greater than 1 and less than 5.

    • @Techthoughts2
      @Techthoughts2  3 роки тому +1

      Let me know if this makes sense. There are many, many ways to do this.
      $foo = 1..5
      $bar = @()
      $foo | ForEach-Object {
      if ($_ -gt 1 -and $_ -lt 5) {
      $bar += $_
      }
      }

    • @Johannes00
      @Johannes00 3 роки тому

      @@Techthoughts2 That's a Here-String function, I think? You're piping $foo into the ForEach-Object, and the $_ is an automatic variable? So, ForEach variable passed into this, check if it's gt 1 AND lt 5, and if it is add it to $bar? Learnt a lot from that example, thanks!
      -Edit, I found out @() is an empty array, whoops! Makes more sense to me. I don't quite understand the difference between lists and arrays yet, especially when it comes to using the pipeline.
      If I want to learn more ways of doing this, what else should I look up?

  • @dalefirmin5118
    @dalefirmin5118 2 роки тому

    It should be repeated that, unlike other programming languages, cmdlets and variables are NOT case sensitive. So $rawfiledata and $rawFileData are the same. And although other special characters can be used, "best practices" is to only use the underscore.

  • @DElionel1995
    @DElionel1995 5 років тому

    Where do you explain arrey's?

    • @Techthoughts2
      @Techthoughts2  5 років тому +1

      Hi Lionel, I haven't gone in depth with Arrays in the series yet. In the meantime here is a great post that covers everything you would want to know: powershellexplained.com/2018-10-15-Powershell-arrays-Everything-you-wanted-to-know/

  • @marialainapreciado5677
    @marialainapreciado5677 3 роки тому

    Honestly this video lost me at the very beginning. What is Get-Process? Why are you using it? Do you have to type Get-Process before using a variable?

  • @TheM0n
    @TheM0n Рік тому