473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Need help with joining a domain

This isn't really a question on .NET, although it is network related. There
doesn't
seem to be a way in .NET to work with domains in any case.

I am writing a C# program to automate the deployment of new notebooks the
first time they are booted after sysprep has done it's thing. I want to join
the notebook to our domain and give it a specific name based on user input.
The two functions I am using for this purpose are NetJoinDomain and
NetRenameMachineinDomain. This is basically what I'm doing:

NetJoinDomain("", domain, "OU=Notebooks,DC=ad,DC=acadiau,DC=ca", username,
password, NETSETUP_JOIN_DOMAIN | NETSETUP_ACCT_CREATE |
NETSETUP_DEFER_SPN_SET);

NetRenameMachineInDomain("", computerName, username, password,
NETSETUP_ACCT_CREATE);

The call to the first function works properly. The call creates a computer
account in the OU indicated and joins the computer to the specified domain.
The call to the rename function almost works as well. The domain account is
renamed with the new computer name, but the function returns error code 2221
and does not rename the local computer name to match the new domain name.
Error code 2221 is defined as "The username could not be found". There is no
indication what the username it's complaining about, but I can only assume
that it's the domain username and password, which is valid.

If I reboot the computer between calls to NetJoinDomain and
NetRenameMachineInDomain, the rename works properly. However, there is no
indication that a reboot is required after calling NetJoinDomain before
using
NetRenameMachineInDomain. I want to avoid excessive reboots to make the
process go more quickly for the user.

If anyone has used these functions in a similar situation and has any
suggestions, I'd appreciate hearing from you. Thanks.
Jul 21 '05 #1
0 1079

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
1
by: Paul Steele | last post by:
I am writing a C# program to automate the deployment of new notebooks the first time they are booted after sysprep has done it's thing. I want to join the notebook to our domain and give it a...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
0
by: Paul Steele | last post by:
This isn't really a question on .NET, although it is network related. There doesn't seem to be a way in .NET to work with domains in any case. I am writing a C# program to automate the...
6
by: joseph speigle | last post by:
hi, Does anybody know offhand what is the correct way to use substr to extract the domain name from a client_referer column as logged by mod_pgsqllog (httpd module), by correcting the following: ...
2
by: jeremiah johnson | last post by:
I have a .net DLL that I've created (based on someone's post in this group, sorry I've forgotten who) and I need a little help with making it work. I want to provide the same functionality as...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
2
by: Supermansteel | last post by:
I am joining these 2 tables together in Access 2003 and can't figure out the exact way of writing this script......Can anyone help? I have the following SQL: SELECT...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.