New Computer Group From List of Computers

(imported topic written by thesurg3on91)

Hello,

I have a list of computers (full DNS names). How can I create a new computer group with the list of the 100+ computers? I would imagine relevance would be the best instead of using the wizard. Any ideas? some of my computer names…

computer1.domain.com

computer2.domain.com

computer3.domain.com

etc.

(imported comment written by jessewk)

Attached is a wizard you can use to generate an ad-hoc group from a list. Just load the OJO from the debug menu and then select ‘Ad-Hoc Group Wizard’ from the Wizards menu. Paste your list of hostnames in the box and click the button. You can then right click the computers in the ad-hoc group and make a manual group from the list.

After clicking the button, if you go back to the wizard you’ll also get a list of any names that didn’t process successfully.

You’ll need your hostnames to match the values in the console’s ‘computer name’ column.

(imported comment written by TommyG91)

I love the ad-hoc group wizard. By my NON master operators need to be able to use it. They can’t see the “wizards” menu. How can I let me non master operators use the ad-hoc group wizard?

thanks

Tom

(imported comment written by TommyG91)

WORKAROUND!

  1. Create a task that does a client force refresh. Right click it and “take default action”.

  2. Under the “target” tab, choose “The computers specified in the list of names below”, then paste in your list of computer names (not IP addresses), then run it.

  3. In the bottom pane, Select all the computers, right click, and choose, “Add to manual group”.

Problem is you can’t see what computers DIDn’t make it into your group. But will get me by for now.

(imported comment written by BenKus)

Hey Tom,

To answer your non-master-operator question:

To use wizards, you must have the “Custom Content” privilege, which you can see in the BES Admin tool… This applies to master operators and non-master-operators…

Ben

(imported comment written by cstoneba)

How could one go about modifing the “AD-Hoc Group Wizard” to search for “last user” instead of “hostname” ?

(imported comment written by jessewk)

Sure, except I don’t have a “last user” property in my deployment so here is an example with “User Name”.

In the code, replace this line:

var rel = ‘ids of bes computers whose (name of it as lowercase = "’+ chomp(names+.toLowerCase()) + ‘")’;

With this:

var rel = ‘ids of bes computers whose (exists value whose (it = "’+ chomp(names+.toLowerCase()) + ‘") of results (it, bes property whose (name of it = “User Name”)))’;

To use a different property, just replace “User Name” in the above code with the name of the property you’d like to match against.

Also, the performance might be terrible if you have lots of computers in your deployment. Let me know if that’s the case and there are ways to change the query.

Jesse

(imported comment written by thesurg3on91)

thanks so much.

(imported comment written by thesurg3on91)

What is the relevance to create a task to force refresh?

(imported comment written by cj6591)

Great tool … here’s one little modification that I added to catch some machines that were being missed in the resolution of the names:

Add the following function to the code …

function trimAll(sString)

{

while (sString.substring(0,1) == ’ ')

{

sString = sString.substring(1, sString.length);

}

while (sString.substring(sString.length-1, sString.length) == ’ ')

{

sString = sString.substring(0,sString.length-1);

}

return sString;

}

Then modify the name lookup inside the function openGroup() …

var rel = ‘ids of bes computers whose (name of it as lowercase = "’+ trimAll(chomp(names+.toLowerCase())) + ‘")’;

This will trim off all spaces from the start and end of the machine names.

If there are spaces then they will not match in a lookup and you will not get all of the machines that you are expecting to … as I found out

(imported comment written by jessewk)

You might want to also trim the name on the relevance side:

var rel = ‘ids of bes computers whose (name of it as lowercase as trimmed string = "’+ trimAll(chomp(names+.toLowerCase())) + ‘")’;

(imported comment written by SystemAdmin)

I came up with some variations on the ad-hoc theme that others may find useful. In the original ad-hoc wizard, the computer name needed to match exactly. Since we use a lot of naming conventions, it is useful put in a portion of a naming convention, then have it identify machines that match. Enjoy AdHocGroupWizardContainingComputer.ojo.

(imported comment written by SystemAdmin)

There is a similar ad-hoc AD OU path wizard. You can search for one or multiple complete or partial OUs or paths in your Active Directory. This again works well with conventions.

(imported comment written by jessewk)

awesome. Thanks Jon!

(imported comment written by SystemAdmin)

I updated the Ad-hoc group wizard to accept IP address’s

next step would be to have wizard with a pulldown and combine all of these, Name, IP, ID, and others

(imported comment written by SystemAdmin)

I updated the “New Computer Group From List of Computers” Wizard to include any field you want, the next step would be to

query all the fields…

below you would add or remove any fields you wanted to query on in the wizard .ojo file

<select name=
"site" size=1> <option value=
"Computer Name">Computer Name</option> <option value=
"Computer Serial">Computer Serial</option> <option value=
"Computer Model">Computer Model</option> </select>

heres the code

<?xml version=
"1.0"?> <BES> <Wizard> <Title>Ad-Hoc Group - Search MISC Fields</Title> <UIHooks Menu=
"Wi&zards" NavBar=
"Wizards" LaunchType=
"Document"></UIHooks> <DefaultPage>Page1</DefaultPage> <Page Name=
"Page1"> <Title>Ad-Hoc Group - Search MISC Fields</Title> <HTML> <![CDATA[ <table> <tr> <td> Paste the list of and Select choice below: <br> <form name=
"form"> <select name=
"site" size=1> <option value=
"Computer Name">Computer Name</option> <option value=
"Computer Serial">Computer Serial</option> <option value=
"Computer Model">Computer Model</option> </select> <select name=
"cond" size=1> <option value=
" = ">Equals</option> <option value=
" contains ">Contains</option> <option value=
" > ">Greater than</option> <option value=
" >= ">Greater than or Equal to</option> <option value=
" < ">Less than</option> <option value=
" <= ">Less than or Equal to</option> </select> </form> <textarea id=
"hostnames" rows=20 cols=60 ></textarea> </td> <td> <td id=
"errorTD"  style=
"display: none"> <br><br><br> Errors: <br/> <textarea rows=20 cols=60 id=
"errorField"></textarea> </td> </tr> </table> <br /> <button onclick=
"openGroup()">Open Ad-Hoc Group</button> <script type=
"text/javascript"> function openGroup() 
{ var names = hostnames.value.split(
'\n'); var ids = 

new Array(); var errs = 

new Array(); errorField.value = 
''; errorTD.style.display = 
'none'; 

for (var i = 0; i< names.length; i++) 
{ var rel = 
'ids of bes computers whose (value of result from (bes property "'+document.form.site.options[document.form.site.selectedIndex].value+
'") of it as lowercase '+document.form.cond.options[document.form.cond.selectedIndex].value +
' "'+trimAll(chomp(names+)) + 
'")'; 
//errs.push(rel); var id = EvaluateRelevance(rel); 
//var id = rel; 

if (id && id.length == 1) 
{ ids.push(id); 
} 

else 

if (id && id.length > 1) 
{ ids = ids.concat(id); 
} 

else 
{ errs.push(chomp(names+)); 
} 
} 

if (errs.length > 0) 
{ errorField.value = errs.join(
'\n'); errorTD.style.display = 
''; 
} OpenComputerGroup(ids); 
} function trimAll(sString) 
{ 

while (sString.substring(0,1) == 
' ') 
{ sString = sString.substring(1, sString.length); 
} 

while (sString.substring(sString.length-1, sString.length) == 
' ') 
{ sString = sString.substring(0,sString.length-1); 
} 

return sString; 
} function chomp(raw_text) 
{ var sometext=raw_text.toLowerCase(); 

return sometext.replace(/(\n|\r)+$/, 
''); 
} </script> ]]> </HTML> </Page> </Wizard> </BES>

(imported comment written by NoahSalzman)

This version is the same as above but now with MAC Address as one of the options.

(imported comment written by SystemAdmin)

Noah,

how about pulling a list of all properties to search from, Just a suggestion :slight_smile:

(imported comment written by NoahSalzman)

Yeah, yeah, yeah… :slight_smile:

I was trying to help a BigFix-ian who needed a MAC search tool… but, yes, the right way to do it would be to build the menu based off of a Relevance query that returned all the properties. Might be a good excuse to learn some Javascript skillz…

(imported comment written by NoahSalzman)

Crowd sourcing request:

Anyone with Javascript skills out there? For such a person it would be really quick (< 15 min) task to fix this Wizard so that the user can pick from a pop-up list of

all

properties (unique values of names of properties of property results of bes computers) rather than just the static five properties that the Wizard has now.