Auto-assign Computers to Groups in Deployment Console
We had problems when new computers were being inserted into the deployment console. We had so many new computers and so many groups to place them in that it became an administrative nightmare! We found a way to have the Deployment Console automatically place new computers into specific groups based on the computer name. Keep in mind our solution was SQL code so you don't have to place them based on computer name only.
As you can see, we have been able to manage where a computer should be located based on the computer name. For example, computers that are in Building E First Floor have E1 at the end of their computer name. This allows us to organize the computers by location with Altiris doing all the work.
The first step is to create a New Group in your deployment console. You will then need to determine the group id that is associated with the group you have just created. To find the group ID, you will need to open your computer_group table from your eXpress database. This can be done with SQL server enterprise manager.
Then right click on the table go to Open Table -> Return All Rows which will produce the results similar to this.
This is where you will find the group_id for the group folder in your DS console. For this example, we will be working with Building E. As you can see, building E has a group id of 19 which is what we will reference in our SQL code to place new computers.
Now we will need to create a new job for the database to place the computer in the correct group.
Here is an example of jobs we currently run with our database. Note the job Auto-assign computers to groups in Deployment Console
In the steps tab you can now add SQL jobs that instruct the database what to do with new computers. Here is the example of the job that places computers from Building E into the Building E group folder.
This is the exact code we use to tell which computer should be in group E:
UPDATE computer
SET group_id = 19 -- this is the id of the actual group folder in the DS console
FROM computer c
WHERE c.name like '%E1' -- parse the computer name... if it ends in "E1" then place in group 19
and
(
SUBSTRING(RIGHT(RTRIM(c.name),3),1,1) in ('0','1','2','3','4','5','6','7','8','9') and
SUBSTRING(RIGHT(RTRIM(c.name),4),1,1) in ('0','1','2','3','4','5','6','7','8','9') and
SUBSTRING(RIGHT(RTRIM(c.name),5),1,1) in ('0','1','2','3','4','5','6','7','8','9') and
SUBSTRING(RIGHT(RTRIM(c.name),6),1,1) in ('0','1','2','3','4','5','6','7','8','9')
) -- the rest of the code parses more of the name to ensure it's a valid computer name.
I hope this have given you a start on how to use SQL and the Altiris database to automate your placement and order of computers in your DS console. Good luck!
- Login or register to post comments
- 1185 reads
- Printer-friendly version





















Subgroups
How does this affect subgroups. For example, let's say I have 3 buildings (A, B and C) and in those buildings I have departments (Accounting, Marketing, IT, etc.).
If I already have computers in the correct building and in subgroups, would this script (or a modification of it to use IP addresses for example) then move the computers out of the subgroups and place them in the main building groups?
yes and no
I have not tested with subgroups yet. But I believe it should act the same as a root group. Each "group" gets assigned a number. You can then assign those computers based on their name by that number. So it should not matter if that group is a subgroup or a root group, the computer will be placed in that group. Again, I have not tested this but it seems perfectly logical.
To answer your second question, no this will not pull computers out of groups they are already in. This script only works when a computer is new to deployment and is in the "new computers" group. To my knowledge, you must manually organize your computers that are currently assigned to groups.
Hope this helps, let me know if you have any other questions
This might be of interest . . .
The following script moves computers to a group based on its IP address:
UPDATE computer SET computer.[group_id] = (SELECT g.[group_id] FROM computer_group g WHERE g.[name] = 'Test Group') FROM computer c LEFT OUTER JOIN computer_group g ON c.[group_id] = g.[group_id] JOIN nic_interface i ON c.[computer_id] = i.[id] WHERE i.[ip] <> '0.0.0.0' AND ((g.[name] LIKE 'New Computers') OR g.[name] IS NULL) AND (i.[ip] LIKE '10.43.6.%' OR i.[ip] LIKE '10.43.7.%' OR i.[ip] LIKE '10.43.15.%')