- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 04:10 AM
Hi all,
Just wanted to know if anyone else has experienced something similar? I'm trying to update the employeeType property in AD. I've copied the update user action and script, all other properties are updating fine. I'm not coming across any errors when testing the action, but I've been advised by the AD side that it is definitely not updating.
I've done a lookup action on the test user to see what that brings back. When I bring back all properties 'employeeType' doesn't exist in the response. When I lookup just the employeeType property (it doesn't say it's invalid), it just brings back an empty array i.e. {}. Not even {"employeeType":""}.
I've not done powershell or customised AD scripts before so I'm guessing I'm missing something simple. Or at least hoping so! If anyone could point me in the right direction I would appreciate it!
This is the relevant section of script:
if($Grade){
$Grade = $Grade -replace "%27","'";
$user.employeeType = $Grade;
}
$result = Set-ADUser -Instance $user -Credential $cred -Server $computer;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 06:08 AM
Try the below script. I just tested out and it's working as expected.
if (test-path env:\SNC_employeeType) {
$type = $env:SNC_employeeType;
$sam = $env:SNC_user;
}
Set-ADUser -Identity $sam -Replace @{EmployeeType = $type} -Credential $cred -Server $computer
Flow action:
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 04:44 AM
Hi @claires74644296
Just try the below script. It'll work.
if($Grade){
$Grade = $Grade -replace "%27","'";
$employeeType = $Grade;
}
$result = Set-ADUser -Instance $user -Replace @{employeeType=$employeeType} -Credential $cred -Server $computer
Hope this helps.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 05:13 AM
Thanks for the help Siva, unfortunately that method doesn't work either. I keep getting this error message when I try that way:
An attempt was made to add an object to the directory with a name that is already in use
Which is odd seeing as I'm using Replace and not Add
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 09:28 AM
Let me test it out in my pdi and give you the exact powershell cmdlet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 06:08 AM
Try the below script. I just tested out and it's working as expected.
if (test-path env:\SNC_employeeType) {
$type = $env:SNC_employeeType;
$sam = $env:SNC_user;
}
Set-ADUser -Identity $sam -Replace @{EmployeeType = $type} -Credential $cred -Server $computer
Flow action:
Regards,
Siva