Update a specific Domain Controller when connecting via LDAP

jonathangilbert
Kilo Sage

Hi all

 

We currently have integration hub connected to Ad using the AD Spoke. The spoke connects using an LDAP Connection.

 

As we have multiple Domain Controllers it can take a while for all the servers to replicate. I have bene asked if it is possible to add extra code into the OOB Powershell script when adding a user to a group that it updates a specific server aswell, ao that when a user is added to a group, they get the access immeadiately.

 

The OOB script is:- 

 

import-module "$executingScriptDirectory\ADSpoke\ActiveDirectoryMain"

if (test-path env:\SNC_groupname) {
$groupname = $env:SNC_groupname;
$username = $env:SNC_username;
};

$groupname = $groupname -replace "%27","'";
$username = $username -replace "%27","'";

SNCLog-ParameterInfo @("Running AddUserToADGroup", $groupname, $username)

addADUserAccountToGroup -domainController $computer -username $username -groupname $groupname -useCred $useCred -credential $cred

 

I was provided this by someone to add in, but I want to check first:- 

 

Add-ADGroupMember -Identity "IT Service Operations Functions - SG" -Members "jbloggs" -Server "amdc01"  .

 

Does anyone have any suggestions or idea on the above or a way that we can get access granted straight away

 

Many Thanks

 

 

0 REPLIES 0