what does this line do ? variable.get()

Welcome Forums General PowerShell Q&A what does this line do ? variable.get()

This topic contains 2 replies, has 3 voices, and was last updated by

5 months ago.

  • Author
  • #116631

    Points: 71
    Rank: Member

    I came across a powershell script with below lines, but I don't understanding what is the role of get() ?
    CollectionSettings = Get-WmiObject -Namespace $NameSpace -Query "Select * From SMS_CollectionSettings Where CollectionID = '$CollectionID'"


  • #116673

    Points: 457
    Helping Hand
    Rank: Contributor

    Not sure. I apparently don't have that WMI class available on my machine, so I can't check myself. However, if you pipe the object to Get-Member, you'll see a bit more information.

    $CollectionSettings | Get-Member

    In essence, ".Get()" is a method on the object. Unfortunately, its bland name doesn't really give us much to go on, and all I can surmise is that it's used to retrieve some data from the class.

  • #116697

    Points: 364
    Helping Hand
    Rank: Contributor

    You need to check MSDN on what that method is for.
    I often find that it's easist to just check in e.g. ISE which Class it belongs to and then just google/bing it.


    Basically it allows you to asynchronously grab the data, so you can continue doing other stuff while it collects the data.
    But you would need to create the observerobject etc. etc. to use it.

    So from the context of the two lines in your example it won't do anything.

The topic ‘what does this line do ? variable.get()’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort