what does this line do ? variable.get()

Hi,
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’”
$CollectionSettings.Get()

Thanks,
Kishor

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.

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.