cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sjohnson
Engaged Sweeper
In my organization we name computers to match the username, however this standard has not always been followed. So I would like to create a report that shows all desktop computers that do not match the username, but I am having some trouble with this. I tried to create a report where dbo.tblComputers.Username <> dbo.tblComputers.Computername but I'm not doing it correctly.

If it is helpful info, all of my desktops are under a Workstations OU (and below there) in AD.

Thank you for your help!
6 REPLIES 6
sjohnson
Engaged Sweeper
Perfect, thank you!
Hemoco
Lansweeper Alumni
try this:

Select Top 1000000 dbo.tblComputers.ComputerUnique, dbo.tblComputers.Username,
dbo.tblComputers.Computername, dbo.tblComputers.Domain, Web40OSName.OSname,
Web40OSName.Compimage As icon
From dbo.tblComputers Inner Join
dbo.web40ActiveComputers On dbo.tblComputers.Computername =
dbo.web40ActiveComputers.Computername Inner Join
Web40OSName On Web40OSName.Computername = dbo.tblComputers.Computername
Inner Join
tblComputersystem On dbo.tblComputers.Computername =
tblComputersystem.Computername Inner Join
tblADComputers On dbo.tblComputers.Computername = tblADComputers.Computername
Where (dbo.tblComputers.Username <> 'Administrator' And
dbo.tblComputers.Username <> 'store') And dbo.tblComputers.Computer <>
dbo.tblComputers.Username And tblComputersystem.Domainrole = 1 And
tblADComputers.OU Like '%OU=Desktops,OU=Workstations,DC=xx,DC=xx,DC=com'
Order By dbo.tblComputers.Computer
sjohnson
Engaged Sweeper
Thank you, that gives me the report I am looking for. I tweaked it to only give me certain workstations under a specific OU. However I need to narrow down the list so that it excludes a couple common usernames. I tried to do this but the code doesn't work, please take a look:


Select Top 1000000 dbo.tblComputers.ComputerUnique, dbo.tblComputers.Username,
dbo.tblComputers.Computername, dbo.tblComputers.Domain, Web40OSName.OSname,
Web40OSName.Compimage As icon
From dbo.tblComputers Inner Join
dbo.web40ActiveComputers On dbo.tblComputers.Computername =
dbo.web40ActiveComputers.Computername Inner Join
Web40OSName On Web40OSName.Computername = dbo.tblComputers.Computername
Inner Join
tblComputersystem On dbo.tblComputers.Computername =
tblComputersystem.Computername Inner Join
tblADComputers On dbo.tblComputers.Computername = tblADComputers.Computername
Where (dbo.tblComputers.Username <> 'Admininstrator' And
dbo.tblComputers.Computer <> dbo.tblComputers.Username And
tblComputersystem.Domainrole = 1 And
tblADComputers.OU Like
'%OU=Desktops,OU=Workstations,DC=xx,DC=xx,DC=com') Or
(dbo.tblComputers.Username <> 'store')
Order By dbo.tblComputers.Computer
Hemoco
Lansweeper Alumni
try this

Select Top 1000000 dbo.tblComputers.Computername,
dbo.tblComputers.ComputerUnique, dbo.tblComputers.Domain, Web40OSName.OSname,
Web40OSName.Compimage As icon, dbo.tblComputers.Computer,
dbo.tblComputers.Username
From dbo.tblComputers Inner Join
dbo.web40ActiveComputers On dbo.tblComputers.Computername =
dbo.web40ActiveComputers.Computername Inner Join
Web40OSName On Web40OSName.Computername = dbo.tblComputers.Computername
Where dbo.tblComputers.Computer <> dbo.tblComputers.Username
Order By dbo.tblComputers.Computer
sjohnson
Engaged Sweeper
It would be rubbish and would probably make absolutely no sense. (I don't know how to code SQL.)
Hemoco
Lansweeper Alumni
Could you post your sql please.