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:
- Launch the Web Interface Configuration tool.
- In the Interface type drop-down list, select the Web Interface, for which you've configured the Home Page Action that creates computers.
- Click Configure Home Page Actions.
- Double-click the Home Page Action that you will use to create new computers.
- Switch to the Form Customization tab.
- In the Predefined Fields section, click Add.
- Select the Computer Name property in the Property name list.
- 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.
- 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.