Set additional AD attributes for New User

David Post
Kilo Expert

I'm attempting to set a few additional attributes on a new user record, using [a copy of the] "Create user" action in the Microsoft AD spoke. My big issue is syntax!

I've added a few new inputs:

  • AccountExpirationDate
  • Manager
  • Path
    find_real_file.png

Then, I updated the 'Define payload' step to include these in the inputs & outputs.

  • find_real_file.png

Then, Included them in the Powershell script inputs.

  • find_real_file.png

Lastly, I updated [a copy of the] ActionCreateNewUserAD.ps1 MID server script file to 'cleanse' the inputs (replacing the %27 with an apostrophe) and set the attributes -AccountExpirationDate $AccountExpirationDate -Manager $Manager -Path $Path (just like how the original script is done)

  • find_real_file.png

The OOB action always creates the user record in the 'Users' container, but I want to consume a variable so that we're dynamically setting the OU where we create the user. I'm trying to send it OU=Developers,OU=Employees,DC=FoxDen,DC=local (my lab domain)

For AccountExpirationDate, the system tries to convert the string into a valid date / time object. I've even tried the input (and other steps) as a Basic Date/Time and Calendar  Date/Time. It always fails to convert!

find_real_file.png

find_real_file.png

And the manager attribute, it doesn't matter what I put in, it can't find the object with the same type message. It looks like whatever I'm sending results as a null value when it tries to convert it.

If I was doing this in PowerShell directly, here's what it looks like and the result:

find_real_file.png

There's got to be some kind of syntax issue on the AccountExpirationDate, manager, and path values. Has anyone run into issues with any of these in the past, and how did you overcome them?

1 REPLY 1

David Post
Kilo Expert

By filling in the PowerShell script variables with the inputs directly, and skipping over whatever outputs the 'define payload' is failing to create, it feeds Active Directory all of the required values. So long as some of these things are hard-coded or defined by the system one wouldn't have much issue with whitespace.