0

I ran into following problem:

When i´m running a query where there is a join inside, then the systemproperty "__PATH" is empty. When im running it without the Join, everything works fine:

Working:

$apps = Get-WMIObject -Namespace root/SMS/site_$($siteCode) -ComputerName $($siteserver) -Query `
"SELECT * FROM SMS_Application where IsLatest='true' and IsExpired='false' and LocalizedDisplayName like '%hydro%'"

$apps[0].__PATH 

Output: "\SCCM\root\SMS\site_CMT:SMS_Application.CI_ID=16781953"

Not working:

$apps = Get-WMIObject -Namespace root/SMS/site_$($siteCode) -ComputerName $($siteserver) -Query `
"SELECT * FROM SMS_Application as App join SMS_ObjectContainerItem as FI on App.ModelName=FI.InstanceKey where App.IsLatest='true' and IsExpired='false' and LocalizedDisplayName like '%hydro%'"

$apps[1].app.__PATH

My Question: Can anyone explain to me why the Path is empty? Thanks a lot, Regards

Community
  • 1
  • 1
R. Ibk
  • 1
  • 2
  • In the non working example do you get any output from `$apps` – Matt Feb 16 '16 at 16:51
  • Actually I think your issue is that WQL does not support joins. http://stackoverflow.com/questions/12583601/joining-two-tables-in-wql-sccm – Matt Feb 16 '16 at 17:09
  • I'm actually a bit surprised the `Get-WmiObject` doesn't throw "Invalid Query" or similar – Mathias R. Jessen Feb 16 '16 at 17:49
  • @Matt Yes the output is an object whitch contains all 2 tables. It is possible to view them with their Alias: $apps.App respectively $apps.FI Both of them work fine (no error or anything) except that the second one has no path. – R. Ibk Feb 17 '16 at 07:42

0 Answers0