PowerShell Master Class - Data and Objects

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 มิ.ย. 2024
  • This module dives into credentials, parsing data and working with objects.
    This is a multi-part class that should be viewed as part of its playlist, • PowerShell Master Class
    Materials for the class available at github.com/johnthebrit/PowerS...
    00:00 Introduction
    00:10 Storing credentials
    03:08 Storing an encrypted version
    05:43 Using Azure Key Vault
    13:02 Certificate authentication
    13:57 Variable types
    14:25 Casting
    18:03 Fun with strings
    23:35 Variable scope
    27:28 Variables with Invoke-Command
    29:23 Using $using
    30:23 Hash tables
    32:38 Using PSObject
    36:15 Foreach-Object
    39:56 ForEach and ForEach-Object
    43:27 Getting property values
    45:53 Coming up next
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 35

  • @imperialdrive
    @imperialdrive 2 ปีที่แล้ว

    I'm going to echo the other comments but still had to share my 'much wow' sentiment towards you. Fantastic content! Thank you for being so generous with your time, effort, and knowledge/wisdom. It is very much appreciated and I aim to play it forward. Cheers from LA/SF.

    • @NTFAQGuy
      @NTFAQGuy  2 ปีที่แล้ว

      Glad you enjoyed it! Thanks for the note!

  • @chrismcgourty1756
    @chrismcgourty1756 2 ปีที่แล้ว

    Knew a lot of this but held on with it because the quirks you showed were great. You've got a great style to explaining. Thanks John.

    • @NTFAQGuy
      @NTFAQGuy  2 ปีที่แล้ว

      Thank you, glad it was useful

  • @richard1101
    @richard1101 หลายเดือนก่อน

    Awesome - Big thank you!

  • @mrtechstawk
    @mrtechstawk 3 ปีที่แล้ว +2

    Excellent as always

    • @NTFAQGuy
      @NTFAQGuy  3 ปีที่แล้ว

      Thank you! Very kind.

  • @NickRoman
    @NickRoman ปีที่แล้ว +1

    Wow, I didn't ever think about using expandproperty that way or didn't know. Forever, I've been putting () around the object like (command).property to get just the property out. Of course, you can also do that with any command that outputs an object without having to use the | select. But, I appreciate knowing both ways.

  • @geroffmilan3328
    @geroffmilan3328 ปีที่แล้ว

    12:25 really glad you covered this, Jon: this is just moving the problem sideways in many cases.
    My background is penetration testing, so breaking more than making 😏 but the use case for this approach seems to be:
    when you *can* use an MSI to execute your script, but the target resource does not support using an MSI for access.
    Or perhaps just where you are running interactively as a given identity, which can be granted access to a Key Vault, but cannot be granted access to one ore more of those target resources.

  • @iamdedlok
    @iamdedlok 3 ปีที่แล้ว

    Great vid again John! Loved the treatise on hashtable to objects. I will try to use more PSObjects going fwd. Didn't know you could so easily cast a hashtable to a PSObject!
    A trick I have found useful when examining what's in the content of complex objects when returned from some other call, is doing a ConvertTo-Json on the returned object.
    Example ... If I want to find out which property lets me see NetworkInterface ids of VMs in Azure..
    Doing a ConvertTo-JSON(Get-AzVm) -Depth 3 .. lets me see it where that property is hiding.
    Powershell is so powerful ;-)
    I am trying to learn Bash too, but keep coming back to PowerShell as it feels so much easier and natural to work with.
    Now only I need to convince my client to install PowershellCore in DevOps pipeline tasks so that I can write powershell as tasks.lol.

  • @BezKomentare
    @BezKomentare 5 ปีที่แล้ว +1

    Excellent video. Thanks!!

  • @lightyagami0ben
    @lightyagami0ben 3 ปีที่แล้ว +3

    really good stuff !!

    • @NTFAQGuy
      @NTFAQGuy  3 ปีที่แล้ว +1

      Thank you!

  • @henrywycislo9454
    @henrywycislo9454 2 ปีที่แล้ว

    Very descriptive video.. Excellent work

    • @NTFAQGuy
      @NTFAQGuy  2 ปีที่แล้ว

      Thank you

  • @ibrahimabdeltawab6418
    @ibrahimabdeltawab6418 ปีที่แล้ว

    Super! Thanks so much

  • @matrixview
    @matrixview 5 ปีที่แล้ว +1

    @John Savill: Thank you so much for creating and posting these great course videos! I love PowerShell, and always looking to learn something new. Hopefully you will also dive into API's, web scraping and html-parsing (which is quite difficult with with PS Core 6.x). How to use Selenium/PhantomJS in PS; or Lucene in PS; meta/proxy-programming (ie. wrapping cmdlets and executables); creating DSL's with PS and LINQ in PS would also be great (specialized) courses. That would be pretty advanced stuff, but that's what interests me... and there aren't many (if any) PS courses yet for that.

  • @t0ffluss
    @t0ffluss 3 ปีที่แล้ว +7

    20:40 - So we're not going to talk about John going to the gym for 6 hours at 3AM? :D

    • @NTFAQGuy
      @NTFAQGuy  3 ปีที่แล้ว +4

      Lol, ironman training :)

    • @t0ffluss
      @t0ffluss 3 ปีที่แล้ว +1

      @@NTFAQGuy #machine ;D

    • @iamdedlok
      @iamdedlok 3 ปีที่แล้ว +1

      Not surprised. He's a beast. The godly kind.

  • @darthVikes
    @darthVikes 5 ปีที่แล้ว +2

    It would be nice to include what each section is in the TH-cam Description section and add times for reference back to the specific section/topics?

    • @NTFAQGuy
      @NTFAQGuy  5 ปีที่แล้ว

      That's a good idea. I was focused on getting everything recorded but now I'm done I'll try and go back through and add more detail with the timings like you say. Thanks!

  • @nitti3723
    @nitti3723 2 ปีที่แล้ว

    So are $global:x, $script:y, $private:z the only way to manually specify what scope I want a variable to use?

    • @NTFAQGuy
      @NTFAQGuy  2 ปีที่แล้ว

      Those are typical scope modifiers. Read the docs on scope of looking for more

  • @manikantaguthula5711
    @manikantaguthula5711 3 ปีที่แล้ว

    $username =(Get-AzKeyVaultSecret -VaultName -Name samplepassword).SecretValueText isn't supporting now @John

    • @NTFAQGuy
      @NTFAQGuy  3 ปีที่แล้ว +1

      they change things. docs has a new example. docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-powershell

    • @manikantaguthula5711
      @manikantaguthula5711 3 ปีที่แล้ว

      @@NTFAQGuy Okay sir, thank you very much

  • @varek9
    @varek9 5 ปีที่แล้ว

    @John Savill
    Hello John,
    I really appreciate your videos, i have learned a lot through them.
    i have just one question about the credential store.
    maybe i understood it the wrong way.
    If you store your password encrypted in a file like this:
    "P@ssword1" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | out-file C:\admin\pw.txt
    If i do the line above, i get a file with the encrypted Password.
    I can import the password like this:
    $pass = Get-Content "C:\admin\pw.txt" | ConvertTo-SecureString
    The thing is, i can only import the password with user i created the file.
    so it is only working in the usercontext.
    That means storing the password in a file is still a safe way, am i right?
    Best Regards

    • @NTFAQGuy
      @NTFAQGuy  5 ปีที่แล้ว

      Anyone with rights on the file would be able to get the content so its really not that secure but better than nothing.

    • @jano.5485
      @jano.5485 ปีที่แล้ว

      Yes I think working with just native Windows capabilities, the Data Protection API (DPAPI) is the safest way to store a credentials since it can only be decrypted by the user who encrypted it and also only on the machine which it was encrypted on.

  • @issiewizzie
    @issiewizzie 5 ปีที่แล้ว

    I feel ashamed I should have learnt Powershell 5 years ago.... A better time to start I guess.
    As for passwords credential in code ... one of our devs followed this bad practice last year.

    • @NTFAQGuy
      @NTFAQGuy  5 ปีที่แล้ว

      It happens a lot :-)