Use Get-ImmyComputer to filter on computername, tags

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*"}