Associated classes

Objects returned by Get-WmiObject have a GetRelated method that can be used to find associated instances.

The GetRelated method accepts arguments that can be used to filter the results. The first argument, relatedClass, is used to limit the instances returned to specific classes, as shown here:

Get-WmiObject Win32_LogonSession | ForEach-Object { 
    [PSCustomObject]@{ 
        LogonName      = $_.GetRelated('Win32_Account').Caption 
        SessionStarted = [System.Management.ManagementDateTimeConverter]::ToDateTime($_.StartTime) 
    }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.251.68