Set additional AD attributes for New User
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 11:02 AM
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
Then, I updated the 'Define payload' step to include these in the inputs & outputs.
Then, Included them in the Powershell script inputs.
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)
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!
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:
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?
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 11:32 AM
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.