Jump to content
MrRat

Assign Contacts to Computers

Recommended Posts

one line script. Working on the assumption that a user's domain login is the same as their email address; this script assigns the last user as the contact. Not perfect but at least it assigns someone.

 

SQL EXECUTE:

UPDATE computers, contacts SET computers.ContactID = contacts.ContactID WHERE computers.ContactID = 0 AND computers.ClientID = contacts.ClientID AND SUBSTRING_INDEX(computers.LastUsername,'\\',-1) = SUBSTRING_INDEX(contacts.Email,'@',1) AND computers.OS NOT LIKE '%Server%' AND contacts.Email <> ''

 

just learning this SQL stuff and having some fun with it

  • Thanks 1

Share this post


Link to post
Share on other sites
Posted (edited)

Hello 

I've tested this command with 2020 version and didn't work.

Any idea on how should I update the query?

Thank you

Edited by mcretari

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...