0 votes

Hi,

One of our requirement is to automaticaly generate computer names, in a incremental way.

For instance

Computer0001
Computer0002
Computer0003

I was unable to do that with Adaxes so far.

This is what I tried:
- I create a custom action "Create computer" in the web interface
- I removed computer name in the input form
- I made sure that computer name was not marked as required in any Property pattern
- I created the following Business rule:
Target: All object
Before creating a computer
$Context.SetModifiedPropertyValue("cn","TEST")
$Context.SetModifiedPropertyValue("samAccountName","TEST$")
$Context.SetModifiedPropertyValue("displayName","TEST$")
# Constant test is for testing purpose

The web page gives me the following error: Name is not specified for the new object

Any idea is welcome.

by (750 points)

1 Answer

0 votes
by (216k points)

Hello,

The thing is that you cannot create a computer without the Computer Name (cn) property specified. Also, you cannot set the Computer Name property with a script, you should set the Name property instead. What we suggest is that you add a predefined field to your Home Page Action that will set the Computer Name for every newly created computer to a certain random value. Then, with the help of your Business Rule, you will set the Computer Name to the value that you need. To do this:

  1. Launch the Web Interface Configuration tool.
  2. In the Interface type drop-down list, select the Web Interface, for which you've configured the Home Page Action that creates computers.
  3. Click Configure Home Page Actions.
  4. Double-click the Home Page Action that you will use to create new computers.
  5. Switch to the Form Customization tab.
  6. In the Predefined Fields section, click Add.
  7. Select the Computer Name property in the Property name list.
  8. Specify a template for random computer name generation in the Default value field, for example, Computer%adm-RandomInteger,6%. %adm-RandomInteger% is a value reference that will be replaced with a random integer. For more information on value references, see Value Reference Format. Also, remember, that a computer name cannot consist of numbers only.
  9. Click OK 4 times.

Also, you'll need a modified version of the script. For example:

$Context.SetModifiedPropertyValue("name","TEST")
$Context.SetModifiedPropertyValue("samAccountName","TEST$")
$Context.SetModifiedPropertyValue("displayName","TEST$")

As to generating incremental computer names, take a look at the Validate/Modify User Input Using a Script Tutorial. In Example 2 on the 5th step of the tutorial you will find how to accomplish a similar task for usernames.

0

Thanks for the idea!

I gave a try and it works as expected. Clever application!

The only downsides of this solution I can think of are the some real unlikely racing conditions and the log overhead; but we don't mind.

Thanks again

0

Hello,

There shouldn't be any log overhead, as the only thing that will be logged additionally is that a script was run on computer creation. Also, no additional changes are made to your Active Directory as changing of the computer name by the script is performed before creating the computer, that is, before any data is committed to Active Directory.

Related questions

0 votes
1 answer

Hi, Is there any native way to auto-increment a custom interger attribute? I know I can use a PS script, but just wondering whether there is a quick way to use an Adaxes action i.e. "CustomAttributeInt1 = CustomAttributeInt1+1" Thanks

asked May 29, 2013 by firegoblin (1.6k points)
0 votes
1 answer

Hi. I'm hoping this will be an easy one but I've been looking all over the place for answer and can't seem to find it. How do you create a unique username ( ... get told that user already exists in domain. Thanks in advance for any pointers in the right place.

asked Apr 9, 2014 by AGMcCabe (50 points)
0 votes
1 answer

Hello, How can I generate a custom login name with this rule : fisrt 3 letters of the first name + 3 letters of the last name? Thanks. TB

asked Apr 19, 2016 by tentaal (1.1k points)
0 votes
1 answer

I am trying to have a scheduled job that will hide groups that are empty and I can not seem to figure out how to do it.

asked Aug 20, 2021 by hgletifer (1.3k points)
0 votes
1 answer

By default The Sign in Page for adaxes is Ex. adaxes.contoso.com/adaxes. After that I already set up the rules to redirect the user to the page that match their permissions ... can I make the Login Page : adaxes.contoso.com (stripping out the /adaxes) Thanks

asked Oct 23, 2019 by davidotz8 (120 points)
3,358 questions
3,057 answers
7,806 comments
545,209 users