→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !
‎10-17-2022 02:25 PM
Hi all,
If I try to edit the old query Active Directory: Enabled/disabled computers it goes into error
Select Top 1000000 Coalesce(os.Image, at.AssetTypeIcon10) As Icon,
a.AssetID,
a.AssetName,
Case
When Coalesce(adc.IsEnabled, 0) = 0 Then 'False'
Else 'True'
End As EnabledInAD,
at.AssetTypename As Type,
a.Domain,
a.Username,
a.Userdomain,
a.IPAddress,
a.Description,
ac.Manufacturer,
ac.Model,
Case (a.Assettype)
When -1 Then os.OSname
When 11 Then ls.OSRelease
When 13 Then mi.SystemVersion
Else ''''
End As OS,
a.SP As SP,
ac.Location,
tsysIPLocations.IPLocation,
a.Firstseen,
a.Lastseen
From tblAssets a
Inner Join tblADComputers adc On a.AssetID = adc.AssetID
Inner Join tblAssetCustom ac On a.AssetID = ac.AssetID
Inner Join tsysAssetTypes at On at.AssetType = a.Assettype
Inner Join tblState s On s.State = ac.State
Left Join tsysOS os On a.OScode = os.OScode
Left Join tblLinuxSystem ls On ls.AssetID = a.AssetID
Left Join tblMacOSInfo mi On mi.AssetID = a.AssetID
Left Outer Join tsysIPLocations On a.LocationID = tsysIPLocations.LocationID
Where s.Statename = 'Active'
Order By adc.IsEnabled Desc,
a.Assettype,
a.AssetName
do you have any suggestions? thank you!
Solved! Go to Solution.
‎10-17-2022 03:30 PM
This is what the code ended up looking like to get it running again in our environment:
Select Top (1000000) Coalesce(os.Image, t.AssetTypeIcon10) As Icon,
a.AssetID,
a.AssetName,
Case
When Coalesce(adc.IsEnabled, 0) = 0 Then 'False'
Else 'True'
End As EnabledInAD,
t.AssetTypename As Type,
a.Domain,
a.Username,
a.Userdomain,
a.IPAddress,
a.Description,
ac.Manufacturer,
ac.Model,
Case (t.Assettype)
When -1 Then os.OSname
When 11 Then ls.OSRelease
When 13 Then mi.SystemVersion
Else ''
End As OS,
a.SP,
ac.Location,
tsysIPLocations.IPLocation,
a.Firstseen As [Created at],
a.Lastseen As [Last successful scan]
From tblAssets As a
Inner Join tblADComputers As adc On a.AssetID = adc.AssetID
Inner Join tblAssetCustom As ac On a.AssetID = ac.AssetID
Inner Join tsysAssetTypes As t On a.AssetType = t.Assettype
Inner Join tblState As s On ac.State = ac.State
Left Outer Join tsysOS As os On a.OScode = os.OScode
Left Outer Join tblLinuxSystem As ls On ls.AssetID = a.AssetID
Left Outer Join tblMacOSInfo As mi On mi.AssetID = a.AssetID
Left Outer Join tsysIPLocations On a.LocationID = tsysIPLocations.LocationID
Where s.Statename = 'Active'
Order By adc.IsEnabled Desc,
a.Assettype,
a.AssetName
‎10-17-2022 03:30 PM
This is what the code ended up looking like to get it running again in our environment:
Select Top (1000000) Coalesce(os.Image, t.AssetTypeIcon10) As Icon,
a.AssetID,
a.AssetName,
Case
When Coalesce(adc.IsEnabled, 0) = 0 Then 'False'
Else 'True'
End As EnabledInAD,
t.AssetTypename As Type,
a.Domain,
a.Username,
a.Userdomain,
a.IPAddress,
a.Description,
ac.Manufacturer,
ac.Model,
Case (t.Assettype)
When -1 Then os.OSname
When 11 Then ls.OSRelease
When 13 Then mi.SystemVersion
Else ''
End As OS,
a.SP,
ac.Location,
tsysIPLocations.IPLocation,
a.Firstseen As [Created at],
a.Lastseen As [Last successful scan]
From tblAssets As a
Inner Join tblADComputers As adc On a.AssetID = adc.AssetID
Inner Join tblAssetCustom As ac On a.AssetID = ac.AssetID
Inner Join tsysAssetTypes As t On a.AssetType = t.Assettype
Inner Join tblState As s On ac.State = ac.State
Left Outer Join tsysOS As os On a.OScode = os.OScode
Left Outer Join tblLinuxSystem As ls On ls.AssetID = a.AssetID
Left Outer Join tblMacOSInfo As mi On mi.AssetID = a.AssetID
Left Outer Join tsysIPLocations On a.LocationID = tsysIPLocations.LocationID
Where s.Statename = 'Active'
Order By adc.IsEnabled Desc,
a.Assettype,
a.AssetName
‎10-17-2022 03:47 PM
Thank You!
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now