G
Guest
Hi,
I have just created a HTA application that uses ADSI to add a new user to the domain, give the first name, last name and description.
This is based on the Scriptomatic tools from TechNet and scripts segments from the TechNet scripting centre.
Everything works great, except for setting the permissions on the home and profile directories.
Having found no scripting object I could use to set permissions, I resorted to the following.
set winShell = CreateObject("WScript.Shell")
winShell.Run "cacls " & profilepath & " /t /e /g " & username & ":F", 1, True
This sometimes works and sometimes doesn't (roughly 50/50). I get the error "No mapping between account names and security IDs was done".
I believe the problem is with the directory not being synchronized between the two Domain Controllers at the time I was attempting to run CACLS (so therefore CACLS was not seeing the user because it somehow managed to always see the other Domain controller, not the one on which the user was created).
If I wait a while before running CACLS, it runs fine. However, just waiting an arbitrary amount of time doesn't seem like a good method to me.
How do the built-in administration tools deal with this issue? Does anyone know of a better way? What determines which DC the ADSI script and the CACLS command looks at?
We're using Windows 2000 Server with two domain controllers, running the script from a Windows 2000 Pro machine.
I have just created a HTA application that uses ADSI to add a new user to the domain, give the first name, last name and description.
This is based on the Scriptomatic tools from TechNet and scripts segments from the TechNet scripting centre.
Everything works great, except for setting the permissions on the home and profile directories.
Having found no scripting object I could use to set permissions, I resorted to the following.
set winShell = CreateObject("WScript.Shell")
winShell.Run "cacls " & profilepath & " /t /e /g " & username & ":F", 1, True
This sometimes works and sometimes doesn't (roughly 50/50). I get the error "No mapping between account names and security IDs was done".
I believe the problem is with the directory not being synchronized between the two Domain Controllers at the time I was attempting to run CACLS (so therefore CACLS was not seeing the user because it somehow managed to always see the other Domain controller, not the one on which the user was created).
If I wait a while before running CACLS, it runs fine. However, just waiting an arbitrary amount of time doesn't seem like a good method to me.
How do the built-in administration tools deal with this issue? Does anyone know of a better way? What determines which DC the ADSI script and the CACLS command looks at?
We're using Windows 2000 Server with two domain controllers, running the script from a Windows 2000 Pro machine.