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%"
$ouPath = "OU=ADX Test,DC=E,DC=BENEFIS,DC=ORG"

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

# Create the new user
Try{
    $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")

}
Catch{
    $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 (1.0k points)

1 Answer

+1 vote
by (289k points)

Hello,

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.

0

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, 2023 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, 2023 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 (160 points)
0 votes
1 answer

The rule runs but since the first name and last name are passed as parameters, I only get the sequential # as a userID without the initials.

asked Oct 24 by curtisa (290 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)
3,548 questions
3,238 answers
8,232 comments
547,810 users