• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 806
  • Last Modified:

Computer to a join a domain through powershell

Hi guys, Im wondering if you gurus could kindly help out with the following.
We would like to have a computer join our domain to the following OU in our domain:

As this will be part of a build process, the computer name should be a variable

OU=Sales,DC=companyA,DC=Com

Is there a way to write:

1.Display on the screen if this had been successful, and
2. to a log file the result to see whether this had been successful

Any help greatly appreciated.
0
Simon336697
Asked:
Simon336697
  • 3
  • 3
1 Solution
 
KenMcFCommented:
If you are using powershell v2 you can use the add-computer cmdlet

Add-Computer -domainname Domain02 -OUPath "OU=testOU,DC=domain,DC=Domain,DC=com"

or

C:\PS>Add-Computer -domainname Domain02 -cred Domain02\Admin02 -passthru

Description
-----------
This command adds the local computer to the Domain02 domain by using the credentials of a domain administrator. The command uses the PassThru parameter to generate a brief report about the results of the command.


http://technet.microsoft.com/en-us/library/dd347556.aspx

To rename the computer you can use the function that Michael B Smith posted on his blog.

http://theessentialexchange.com/blogs/michael/archive/2008/02/04/Rename-Reboot-with-Powershell.aspx
0
 
Simon336697Author Commented:
Hi Ken, thanks so much for this.

We are tyring to create a build image for Windows 7.

Id like to slowly replace our existing vbs scripts with powershell, but dont know how to activate usage of powershell in a winpe environment. Is this possible to do?
0
 
KenMcFCommented:
The .Net framework is not directly supported in the WinPE env. Take a look at this link.

http://social.technet.microsoft.com/Forums/en/w7itproinstall/thread/61a7b6e9-2190-4672-bac5-cb6a0bb52b7e
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
Simon336697Author Commented:
Hi KenMcF,
Ken, silly question possibly, but how does something like MDT from Microsoft then use powershell in a winpe environment?
0
 
KenMcFCommented:
Sorry, you are correct. The link I posted before was before MDT2010 was released. With that release you are able to run powershell.
0
 
Simon336697Author Commented:
Thanks so much Ken really appreciate it.
0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now