Here is an example of how to make a Filter Script that filters on multiple conditions.
First, I discovered the -includetags parameter by running a helper script to see the commands.
get-help Get-ImmyComputer
With this we were able to combine current inventory information with the Tags applied at the Tenant level for use in our cross-tenant deployments that are targeting Windows 10/11, excluding virtual machines / cloud PCs and management workstations.
Get-ImmyComputer -includetags | ?{
$_.OperatingSystemName -like "*Windows 1*" -and
$_.Name -notlike "*MGMT*" -and
$_.Inventory.WindowsSystemInfo.Model -notlike "*Virtual*" -and
$_.Inventory.WindowsSystemInfo.Manufacturer -notlike "*VMware*" -and
$_.Tags -like "*Deploy-SomeApplication*"}```
Great example of a more complex filter script! A lot of samples (simpler ones, albeit) are in the script repository.
Thank you! I just realized my script example has extra quotes from my formatting. Doesn’t look like I can edit anymore.
Should just be:
Get-ImmyComputer -includetags | ?{
$_.OperatingSystemName -like "*Windows 1*" -and
$_.Name -notlike "*MGMT*" -and
$_.Inventory.WindowsSystemInfo.Model -notlike "*Virtual*" -and
$_.Inventory.WindowsSystemInfo.Manufacturer -notlike "*VMware*" -and
$_.Tags -like "*Deploy-SomeApplication*"}
what command - and how do we run it - do we use to see everything available behind Get-ImmyComputer? especially things like -InventoryKeys
I was able to run change the context of a script to meta, and run this against 1 particular device to see the data behind -InventoryKeys
Get-ImmyComputer -InventoryKeys WindowsSystemInfo | ConvertTo-Json -Depth 10
@Steve_King how did you run the helper script?
Make a script and have that as the body - run and see the output.