cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tgt
Engaged Sweeper III
Hi,

is it possible to find services with unqoted pathes that contain whitespaces via a report?

Because in the Service overview under Asset/Config/Windows/Services there are not Paths visible.

Thank you!
1 REPLY 1
RCorbeil
Honored Sweeper II
Here's a quickie you should be able to build on:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblServicesUni.Pathname AS [Service Pathname]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblServices On tblAssets.AssetID = tblServices.AssetID
Inner Join tblServicesUni On tblServicesUni.ServiceuniqueID = tblServices.ServiceuniqueID
Where tblAssetCustom.State = 1
AND Left(tblServicesUni.Pathname, 1) <> '"' -- ignore paths that are quoted
AND CharIndex(' ', -- look for paths that contain a space
-- trim off parameters from the path where we can:
CASE
-- if the service executable ends in '.exe', that should be the end of the path; anything else should be parameters
WHEN CharIndex('.exe', tblServicesUni.Pathname) > 0 THEN Left(tblServicesUni.Pathname, CharIndex('.exe', tblServicesUni.Pathname)+3)
-- in case it's not an exe, some parameters start with a -, so look for that and assume that's the end of the path
WHEN CharIndex(' -', tblServicesUni.Pathname) > 0 THEN Left(tblServicesUni.Pathname, CharIndex(' -', tblServicesUni.Pathname)-1)
-- in case it's not an exe, some parameters start with a /, so look for that and assume that's the end of the path
WHEN CharIndex(' /', tblServicesUni.Pathname) > 0 THEN Left(tblServicesUni.Pathname, CharIndex(' /', tblServicesUni.Pathname)-1)
-- parameters that don't start with - or / will slip through, so some manual examination may be necessary
ELSE Pathname
END) > 0

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now