Categories

Add-Computer

I was building some test machines yesterday and needed to add them to the domain. As they were Windows 2008 R2 with PowerShell v2 I decided to try Add-Computer.

Add-Computer -DomainName mydomain -Credential mydomain\myaccount; restart-computer

You will be prompted for the password.

This only works on the local computer – you can’t add a remote machine.

Simple and effective command.

3 Responses to Add-Computer

  • Shakiel says:

    Thanks for the one liner it works like a dream.

  • Sachin says:

    Hi Richard,

    I am Sachin, new to powershell and Active directory. I am creating a web based application(asp.net, C#) which should create a new user/group in Active Directory. I want to run that application on my laptop which is not part of any domain. But, the server machine whose active directory i want to call is a domain server. Can i update Active directory content from any machine (Public) if I have required credentials ?

    Please share some code samples snippet. It’s urgent!!!

  • RichardSiddaway says:

    Please the comments on the forum at http://powershell.com/cs/forums/t/9017.aspx

    about this question

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>