Ran into the same problem, found the parentheses in the Where statement were incorrect, here's my fixed code:
Where (tsysOS.OSname In ('Win 2008 R2', 'Win 2012', 'Win 2012 R2', 'Win 2016',
'Win 2019') Or (tsysOS.OScode Like '10.0.18362' Or
tsysOS.OScode Like '10.0.18363' Or tsysOS.OScode Like '10.0.19041')) And
tblAssetCustom.State = 1 And tsysAssetTypes.AssetTypename Like 'Windows%' And
tblComputersystem.Domainrole In (4, 5)