// GetElementsAssociatedClass returns a list of WMI paths to class instances identified by instanceID
GetElementsAssociatedClass returns a list of WMI paths to class instances identified by instanceID
// GetElementsAssociatedClass returns a list of WMI paths to class instances identified by instanceID
func GetElementsAssociatedClass(conn *wmi.WMI, className, instanceID string, extraQParams []wmi.Query) ([]string, error) {
	fields := []string{}
	qParams := []wmi.Query{
		&wmi.AndQuery{
			wmi.QueryFields{
				Key:   "InstanceID",
				Value: fmt.Sprintf("%%%s%%", instanceID),
				Type:  wmi.Like},
		},
	}
	if extraQParams != nil && len(extraQParams) > 0 {
		qParams = append(qParams, extraQParams...)
	}
	results, err := conn.Gwmi(className, fields, qParams)
	if err != nil {
		return nil, errors.Wrap(err, "Gwmi")
	}
	elem, err := results.Elements()
	if err != nil {
		return nil, errors.Wrap(err, "Elements")
	}
	ret := make([]string, len(elem))
	for idx, val := range elem {
		pth, err := val.Path()
		if err != nil {
			return nil, errors.Wrap(err, "Path")
		}
		ret[idx] = pth
	}
	return ret, nil
}
func GetElementsAssociatedClass ( conn * wmi . WMI , className , instanceID string , extraQParams [ ] wmi . Query ) ( [ ] string , error ) { fields := [ ] string { } qParams := [ ] wmi . Query { & wmi . AndQuery { wmi . QueryFields { Key : " " , Value : fmt . Sprintf ( " " , instanceID ) , Type : wmi . Like } , } , } if extraQParams != nil && len ( extraQParams ) > 0 { qParams = append ( qParams , extraQParams ... ) } results , err := conn . Gwmi ( className , fields , qParams ) if err != nil { return nil , errors . Wrap ( err , " " ) } elem , err := results . Elements ( ) if err != nil { return nil , errors . Wrap ( err , " " ) } ret := make ( [ ] string , len ( elem ) ) for idx , val := range elem { pth , err := val . Path ( ) if err != nil { return nil , errors . Wrap ( err , " " ) } ret [ idx ] = pth } return ret , nil }
GetElementsAssociatedClass returns a list of WMI paths to class instances identified by instanceID
GetElementsAssociatedClass returns a list of WMI paths to class instances identified by instanceID