adding computers to a domain using command line

I want a  command to add computers to my  Windows Active directory domain
Ashar KallumpurathuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marwan OsmanCommented:
one computer or a list of PCs?
0
Marwan OsmanCommented:
Add-Computer -DomainName yourdomain -Restart
0
Marwan OsmanCommented:
run it from the PC which you want to add it to the domain
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Marwan OsmanCommented:
0
Ashar KallumpurathuAuthor Commented:
Will you  Show me an example
0
Marwan OsmanCommented:
suppose you want to add the PC named testpc to your domain named lab.com

logon to testpc, open the powershell as administrator, type: Add-Computer -DomainName lab.com -Restart

the pc is added to the domain and will restart automatically, is it clear?
0
Ashar KallumpurathuAuthor Commented:
its showing the  following errors when typing this command
Add-Computer : A parameter cannot be found that matches parameter name 'Restart'.
At line:1 char:46
+ Add-Computer -DomainName Dascase.com -Restart <<<<
    + CategoryInfo          : InvalidArgument: (:) [Add-Computer], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.AddComputerCommand
 how to resolve this error
0
Marwan OsmanCommented:
run : Add-Computer -DomainName lab.com

then restart the pc manually
0
Ashar KallumpurathuAuthor Commented:
Add-Computer : This command cannot be executed on target computer('SRV1') due to following error: The specified domain
either does not exist or could not be contacted.
At line:1 char:13
+ Add-Computer <<<<  -DomainName Dascase.com
    + CategoryInfo          : InvalidOperation: (SRV1:String) [Add-Computer], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.AddComputerCommand
Now its Showing the above error
0
Marwan OsmanCommented:
try Add-Computer -DomainName Dascase
0
Ashar KallumpurathuAuthor Commented:
Add-Computer : This command cannot be executed on target computer('SRV1') due to following error: Unknown error (0xa8b
.
At line:1 char:13
+ Add-Computer <<<<  -DomainName Dascase
    + CategoryInfo          : InvalidOperation: (SRV1:String) [Add-Computer], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.AddComputerCommand
now its showing this error
0
Marwan OsmanCommented:
Add-Computer -DomainName Dascase.com -credential dascase\administrator

when you run this cmd, it will ask you to type the password, try and inform me please
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ashar KallumpurathuAuthor Commented:
Add-Computer : This command cannot be executed on target computer('SRV1') due to following error: The specified domain
either does not exist or could not be contacted.
At line:1 char:13
+ Add-Computer <<<<  -DomainName Dascase.com -credential dascase\administrator
    + CategoryInfo          : InvalidOperation: (SRV1:String) [Add-Computer], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.AddComputerCommand
now its showing this error
0
Marwan OsmanCommented:
I tried and it works with me, this is the correct cmd, it seems you have a problem contacting your domain.

since you asked about a command and the command is provided to you, this question must be closed, and you can ask in a separate question on how to troubleshoot the problem.
0
Ashar KallumpurathuAuthor Commented:
can u answer me the other question i asked you about manualy joining a computer to  a domain
0
Seth SimmonsSr. Systems AdministratorCommented:
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
Marwan OsmanCommented:
he asked about a cmd to join a PC to the domain and an example and I replied him with the correct comment after testing it to join a PC to windows 2008 domain, below is my comment:

Add-Computer -DomainName Dascase.com -credential dascase\administrator

when you run this cmd, it will ask you to type the password, try and inform me please


so this is the correct answer to his question, and since he received an error, this is another issue and need troubleshooting, he can ask about it in a separate question.
0
Marwan OsmanCommented:
the correct answer is in the comment which has the ID 40809783, the asker only asks about a cmd to add a computer to a domain and I provided it to him after successfully test it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.