0

Hi

I have 2 Wmi object with one of them being a property of the other.

here is my code.

$connections = get-wmiobject -class 'HNet_Connection' -Namespace  'root\Microsoft\HomeNet' ; 

$connectioName = 'ethernet';

#Write-Host $connections;

foreach ($connection in $connections)
{
if ( $connection.Name -eq $connectioName) 
{
$connectionx = $connection;
Write-Host $connectionx;
}
}


$connectionproperties = get-wmiobject -class 'HNet_Connectionproperties' -Namespace  'root\Microsoft\HomeNet' ;
}

So I have the connection object now I want to use it as input parameter to find the associated connection properties and I have no Idea how to do it. I don't want to parse anything; I can do some parsing on the string but for sure there should be a way to use this object as is.

Any input on how to use object in the where ( simple WQL query instead of power shell)

select * from something where something.otherobject = otherobject;

something like above.

Any ideas.

Thanks.

user1088352
  • 401
  • 3
  • 5
  • 11
  • Please clean up your question a little bit. Also be careful with your language, some of your terms are a little confusing from a PowerShell perspective. – Jason Morgan May 05 '14 at 21:17

1 Answers1

0

So the quick answer is yes, or at least as far as I understand your question the answer is yes.

Get-WmiObject has a -filter parameter that you can use to input a WQL query. As an Example:

$service = Get-WmiObject Win32_service -Filter "Name = 'Bits'" Get-WmiObject Win32_process -Filter "ProcessID = $($service.ProcessId)"

The $() symbol indicates a subexpression I use it in this case to expand out the ProcessID property on the Service variable.

Jason Morgan
  • 1,055
  • 7
  • 10