The API call that syncs the entire domain also syncs individual BDC with the
PDC
A "control" parameter is passed to the API which determines what type of
synchronization.
However, havn't got it working yet, but I soon will! (It's part of a major
project that I'm working on and a solution has to be found)
However, a temporary fix is to get your VB code to execute the following:
NET ACCOUNTS /SYNC
However, this has to be executed on the BDC (or PDC) and it probably syncs
the entire domain.
So a piece of code that reads the LOGONSERVER environment variable and reads
the time on the LOGONSERVER and then schedules a job to run in say 10
seconds time on this server, that executed the above command, would probably
work. However, the person who is logged in, would have to be an
administrator because only administrators can schedule jobs to run.( The
soon command from the NT4 resource kit could be used to schedule the job if
you can't get an API call to do the job)
I know it's a bit clumsy but it would probably work!
Also there is someone on the Windows Scripting Host (WSH) newsgroup who has
wrote a dll (that was released yestaday) that can be called using a
getobject command in your code. However, this syncs the entire domain.
Here's the message from Ian on wsh newsgroup:
**********
You can download this from http://wsh.glazier.co.nz/frame.htm in the
download page.
Sample code...
Set oSer = CreateObject("ServerTools.Tools")
Dim srvname
Dim success
srvname = oSer.GetPDCName("Domain_Name")
Wscript.echo srvname
success = oSer.SyncPDC("Domain_Name")
Wscript.echo success
The control is FreeWare. Use it at YOUR own risk not mine.
New versions will be posted on http://wsh.glazier.co.nz
Subscribe to the newsletter if you want to be kept informed
of any updates and other cool WSH stuff.
Regards,
Ian
****************************************************
From Stuart
Quote:
>Have you had any luck with resyncing a specific bdc?
>Any information is greatly appreciated.
>Thanks,
>Noramn Menz
>> Hello Patrick!
>> I have the same challenge except I want to synchronize a given BDc with
the
>> PDC
>> I havn't got a complete solution yet. However, there is some info in the
>> lmaccess.h file
>> It refers to a I_NetLogonControl api call in the Netapi32.dll
>> This appears to let you do various things including synching am exntire
>> domain as well as synching an individual BDC with the PDC
>> I have managed to declare the API in VB5 but do not have enough info on
all
>> the parameters that are passed to the API - The main one being the "Query
>> Value" parameter.
>> I am working on the problem and hope to have an answer soon.
>> Apparantly the synching of domain controllers API is not one that
microsoft
>> have documented very well!
>> From Stuart Grace
>> >Does anyone know the API call to force the PDC to resync the domain? I
>> need
>> >to create a account and use it right away for assigning permissions in a
>> >resource domain. Since the account doesn't exist on all BDCs the
resource
>> >server fails to authenticate the new account.
>> >Patrick A. Dant
>> >CSC