0 votes

Hello, I am scripting user creation. I have created a custom command where an end user will submit info for the user to be created from: Here is the scirpt:

# Import the Adaxes module
Import-Module Adaxes
# User details
$userName = "%param-LastName:lower,4%%param-FirstName:lower,3%%param-Initial:lower,1%o"
$firstName = "%param-FirstName%"
$initial = "%param-Initial%"
$lastName = "%param-LastName%"
$displayName = "%param-LastName%,%param-FirstName%"
$employeeType = "%param-EmployeeType%"
$City = "%param-City%"
$Title = "%param-Title%"
$Manager = "%param-Manager%"
$EndDate = "%param-EndDate%"

# Generate a random password
$passwordLength = 10
$validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$^&`*()_-=+[]{}|;:',.<>/?~"
$password = -join ((Get-Random -Count $passwordLength -InputObject $validChars) -join "")

# Create the new user
    $newUserParams = @{
        'Name' = $userName
        'GivenName' = $firstName
        'Surname' = $lastName
        'Initials' = $initial
        'DisplayName' = $displayName
        'employeeType' = $employeeType
        'City' = $City
        'title' = $Title
        'Path' = $ouPath
        'AccountPassword' = (ConvertTo-SecureString $password -AsPlainText -Force)
        'Enabled' = $true
        'AccountExpirationDate' = $EndDate
    $user = New-AdmUser @newUserParams -AdaxesService localhost -ErrorAction Stop -Verbose

    $Context.LogMessage("$displayName was created", "Information")

    $Context.LogMessage("$displayName failed Error "+$_.Exception.Message, "Error")

I get this error: image.png Full Error Text: Flinstone,Jake failed Error A parameter cannot be found that matches parameter name 'employeeType'. This attribute is both in AD and ADaxes Schema. image.png image.png I have tried using "Employee Type" as in the screen shot above but same error.

by (780 points)

1 Answer

+1 vote
by (257k points)


The issue occurs because the New-AdmUser cmdlet does not have a dedicated parameter for the Employee Type property. You need to use the -OtherAttributes parameter to set it.


I see works perfectly. Thanks for the help.

Related questions

0 votes
1 answer

Is there a way to have the Create User trigger to run a command to trigger the update user flag/trigger to be hit? The goal is to have specific Create User tasks to also go through the same tasks as the Update user.

asked Mar 2 by mobosys (290 points)
0 votes
1 answer

I need a way of triggering a business rule based on the user (and not the group) being added or removed from a group. The reason I would like this triggered on the user is so ... prefer not to do that. I am checking to see if there is another way to do this.

asked May 16 by mark.it.admin (2.3k points)
0 votes
1 answer

I have a dropdown-field on the web surface, which is populated by a script. The script looks up all groups in a specific OU and displays them. In the Property Pattern ... random order. What should i do to show the groups in alphabetical order in the portal?

asked Sep 15, 2020 by lohnag (140 points)
0 votes
0 answers

We are in hybrid mode with 365. All the accounts we create have to made with a .com instead of .local. How can I make that change in adaxes? Or is this some default I need to change in AD instead?

asked Apr 11, 2022 by LEGIT1 (150 points)
0 votes
1 answer

I am getting the following error... The type initializer for 'System.Management.Automation.PSCredential' threw an exception. The term 'Get-AdmUser' is not recognized as the ... working for months and then suddenly... BOOM! They started throwing this error.

asked Sep 2, 2016 by rmedeiros (380 points)
3,171 questions
2,874 answers
506,934 users