0 votes

Is Set-AdmUser supposed to trigger a User Update Business rule? I have a business rule that is supposed to run after a user is updated, but it doesnt appear that when I use a powershell script to Set-AdmUser, that it triggers the business rule afterwards. Is this working as intended?

by (120 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello,

The thing is that Adaxes cmdlets can interact with Active Directory either via Adaxes service or directly. When cmdlets interact with Active Directory directly, Adaxes service is not involved in the operation, and no Business Rules are triggered. To force a cmdlet to interact with Adaxes service, you need to specify the DNS name of the Adaxes service via the -AdaxesService parameter. For more information and examples, see section AdaxesService in Set-AdmUser.

0

Thats the odd thing. I have the adaxes service stated...

Expert from powershell Scheduled Task

$global:adaxes_server = "adaxes.mydomainhere.net";
$global:dc_server = "dc01.mydomainhere.net";
...
...
        Set-AdmUser `
            -Identity $upd_user `
            -Title (Get-Culture).TextInfo.ToTitleCase($imported_user_var.JOBTITLE.ToLower()) `
            -Department (Get-Culture).TextInfo.ToTitleCase($imported_user_var.DEPTNAME.ToLower()) `
            -EmployeeID $imported_user_var.ID `
            -Replace @{`
                                'departmentNumber'="$($imported_user_var.DEPTCODE)"; `
                                'plchPCN'="$($imported_user_var.PCN)"; `
                                'plchHireDate'="$($imported_user_var.HIREDATE)"; `
                                'plchPayClass'="$($imported_user_var.PAYCLASS)"; `
                                'plchFTE'="$($imported_user_var.FTE)"; `
                                'plchManager'="$($imported_user_var.MANAGERFLAG)"; `
                                'plchManagerPCN'="$($imported_user_var.PCNMGRID)"; `
                                'plchStatus'="$($imported_user.STATUS)"; `
                                'ipphone'="$($imported_user_var.ID)"; `
                             } `
            -Manager $user_manager `
            -Server $global:dc_server `
            -AdaxesService $global:adaxes_server `
            -ErrorAction Stop;

And it works fine...

My Business Rule...

I am not getting these emails. I get emails for every other place I have this action setup, but for some reason not this business rule.

0

chazlander,

Humble opinion.....Your script is indicating both a DC and the Adaxes service when it should be one or the other. Do you see any log entries when your script runs? If not, sure sign you are not running it through your Adaxes service.

0

Gotcha, I'll run without the DC, I thought it required both, but I guess it hooks into the domain via the adaxes service and the DC is not needed. Let me try and I'll report back.

0

Ran without the

            -Server $global:dc_server `

argument and still did not get any emails. I would expect one for every user I run the "Set-AdmUser" cmdlet on correct?

0

Hello again,

First of all, this statement is wrong:

Your script is indicating both a DC and the Adaxes service when it should be one or the other.

You can use the -AdaxesService and -Server parameters together.

Secondly, your script looks OK and should trigger your Business Rule, but for one occasion. The Business Rule will not be triggered when your script does not modify anything. So, if your script sets all properties of all the users to the same values that they already have, your script won't actually modify anything and will not trigger any Business Rules.

Also, check whether your script is run at all. To check this, have a look at the Activity History of the Scheduled Task.

And finally, since you are running the script from a Scheduled Task, why do use the cmdlets and not ADSI interfaces? With ADSI interfaces, the script will work faster and will be much easier to write.

0

1.) Thanks I will add that -server flag back in there
2.) I will modify an AD object with known bad data that should get overwritten from the script to ensure that it is triggering the Business Rule. I'll report back
3.) I added a throw("Success") after the set-admuser command and got an email for every user.
4.) I am more familiar with Powershell especially when I'm using an extract from my HR dept to CRUD users

0

Before:

After:

So my Set-AdmUser function did update the entry, but my Business Rule was not triggered.

0

I even altered the Business rule to require approval, just in case it was an email flow problem that I wasn't getting notified. But after doing so and testing again, my approvals requests are empty.

Related questions

0 votes
1 answer

I'm currently running a SQL SPROC from within powershell, getting a value, and attempting to assign that value to an AD attribute. Everything goes fine getting the value, but ... avoid calling PS from within PS to load the module and run the command. Thanks!

asked Feb 3, 2017 by gmadd13 (50 points)
0 votes
1 answer

We currently have a form for HR to deal with ex-employees that are hired once more, but it's not much more than automatic emails sent to IT. If I add some actions ... this trigger the business rule we have that targets "After updating a user" ? Thanks, Louis

asked Oct 18, 2022 by lw.fa (150 points)
0 votes
1 answer

Trying to set the primary proxy when doing a name change on an email address.

asked Jul 13, 2023 by mightycabal (1.0k points)
0 votes
1 answer

Hello, I try to update user properties per Powershell with "Custom commands". Code below generates following error. Operation is not valid due to the ... AdmUser -Identity $identity -Server $domain -EmployeeID "A123456" -AdaxesService localhost regards Helmut

asked Jan 23, 2019 by a423385 (510 points)
0 votes
1 answer

Hi, I know there probably better places for this question but since I need to use Get-AdmUser I was wondering if you could help me build a Filter to find all ... automatically send a report every month but we need to narrow it down Thanks in advance Ingemar

asked Sep 15, 2015 by ijacob (960 points)
3,588 questions
3,277 answers
8,303 comments
548,100 users